| File: | t/lib/Code/Statistics/FileTest.pm |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | 2 2 2 | 0 0 0 | use strict; | ||||
| 2 | 2 2 2 | 0 0 0 | use warnings; | ||||
| 3 | |||||||
| 4 | package Code::Statistics::FileTest; | ||||||
| 5 | |||||||
| 6 | 2 2 2 | 0 0 0 | use lib '../..'; | ||||
| 7 | |||||||
| 8 | 2 2 2 | 0 0 0 | use parent 'Test::Class::TestGroup'; | ||||
| 9 | |||||||
| 10 | 2 2 2 | 0 0 0 | use Test::More; | ||||
| 11 | 2 2 2 | 0 0 0 | use Test::MockObject; | ||||
| 12 | 2 2 2 | 0 0 0 | use Path::Class 'dir'; | ||||
| 13 | |||||||
| 14 | 2 2 2 | 0 0 0 | use Code::Statistics::File; | ||||
| 15 | |||||||
| 16 | sub make_fixtures : Test(setup) { | ||||||
| 17 | 2 | 0 | my ( $self ) = @_; | ||||
| 18 | |||||||
| 19 | 2 | 0 | my $collector = Test::MockObject->new; | ||||
| 20 | 2 | 0 | $collector->set_isa( 'Code::Statistics::Collector' ); | ||||
| 21 | 2 | 0 | $collector->set_always( 'relative_paths' ); | ||||
| 22 | 2 | 0 | $collector->set_always( 'foreign_paths' ); | ||||
| 23 | |||||||
| 24 | 2 | 0 | $self->{collector} = $collector; | ||||
| 25 | |||||||
| 26 | 2 | 0 | $self->{file} = Code::Statistics::File->new( collector => $self->{collector}, original_path => 'data/json/basic_collect.json', path => 'data/json/basic_collect.json' ); | ||||
| 27 | |||||||
| 28 | 2 | 0 | return; | ||||
| 29 | 2 2 2 | 0 0 0 | } | ||||
| 30 | |||||||
| 31 | sub _format_file_path : TestGroup(file path formatting works with different inputs) { | ||||||
| 32 | 2 | 0 | my ( $self ) = @_; | ||||
| 33 | |||||||
| 34 | 2 | 0 | is( | ||||
| 35 | $self->{file}->_format_file_path->path, | ||||||
| 36 | dir('data/json/basic_collect.json')->absolute->stringify, | ||||||
| 37 | 'without any params set, files get formatted to native and absolute paths' | ||||||
| 38 | ); | ||||||
| 39 | |||||||
| 40 | 2 | 0 | return; | ||||
| 41 | 2 2 2 | 0 0 0 | } | ||||
| 42 | |||||||
| 43 | 1; | ||||||