File: 06_distname.t

package info (click to toggle)
libfile-sharedir-projectdistdir-perl 1.000004-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 400 kB
  • ctags: 22
  • sloc: perl: 442; makefile: 2
file content (60 lines) | stat: -rw-r--r-- 1,346 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

use strict;
use warnings;

use Test::More 0.96;
use FindBin;
use lib 't/lib';
use FakeFS;
my $fake;

BEGIN {
  $fake = FakeFS->new( root => "$FindBin::Bin/06_files" );
  $fake->add_file( 'develdir/.devdir'                               => q[] );
  $fake->add_file( 'develdir/share/file'                            => q[05] );
  $fake->add_file( 'installdir/lib/auto/share/dist/Example_04/file' => q[04] );
  $fake->add_file( 'develdir/lib/Example_05.pm'                     => <<'EOF_A');
use strict;
use warnings;

package Example_05;

use File::ShareDir::ProjectDistDir qw( :all ), distname => 'Example_05';

use Path::Tiny qw(path);

sub test {
  return scalar path( dist_file('file') )->slurp();
}

1;
EOF_A
  $fake->add_file( 'installdir/lib/Example_04.pm' => <<'EOF_B');
use strict;
use warnings;

package Example_04;

use File::ShareDir::ProjectDistDir qw( :all ), distname => "Example_04";

use Path::Tiny qw(path);

sub test {
  return scalar path( dist_file('file') )->slurp();
}

1;
EOF_B

}
use lib "$FindBin::Bin/06_files/installdir/lib";
use lib "$FindBin::Bin/06_files/develdir/lib";    # simulate testing in a child project.

use Example_04;
use Example_05;

is( Example_04->test(), '04', 'Example 04 returns the right shared value' );
is( Example_05->test(), '05', 'Example 05 returns the right shared value' );

done_testing;