File: | t/lib/Code/Statistics/FileTest.pm |
Coverage: | 100.0% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | 1 1 1 | 0 0 0 | use strict; | ||||
2 | 1 1 1 | 0 0 0 | use warnings; | ||||
3 | |||||||
4 | package Code::Statistics::FileTest; | ||||||
5 | |||||||
6 | 1 1 1 | 0 0 0 | use lib '../..'; | ||||
7 | |||||||
8 | 1 1 1 | 0 0 0 | use parent 'Test::Class::TestGroup'; | ||||
9 | |||||||
10 | 1 1 1 | 0 0 0 | use Test::More; | ||||
11 | 1 1 1 | 0 0 0 | use Test::MockObject; | ||||
12 | 1 1 1 | 0 0 0 | use Path::Class 'dir'; | ||||
13 | |||||||
14 | 1 1 1 | 0 0 0 | use Code::Statistics::File; | ||||
15 | |||||||
16 | sub make_fixtures : Test(setup) { | ||||||
17 | 1 | 0 | my ( $self ) = @_; | ||||
18 | |||||||
19 | 1 | 0 | my $collector = Test::MockObject->new; | ||||
20 | 1 | 0 | $collector->set_isa( 'Code::Statistics::Collector' ); | ||||
21 | 1 | 0 | $collector->set_always( 'relative_paths' ); | ||||
22 | 1 | 0 | $collector->set_always( 'foreign_paths' ); | ||||
23 | |||||||
24 | 1 | 0 | $self->{collector} = $collector; | ||||
25 | |||||||
26 | 1 | 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 | 1 | 0 | return; | ||||
29 | 1 1 1 | 0 0 0 | } | ||||
30 | |||||||
31 | sub _format_file_path : TestGroup(file path formatting works with different inputs) { | ||||||
32 | 1 | 0 | my ( $self ) = @_; | ||||
33 | |||||||
34 | 1 | 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 | 1 | 0 | return; | ||||
41 | 1 1 1 | 0 0 0 | } | ||||
42 | |||||||
43 | 1; |