Commit | Line | Data |
edff3fdc |
1 | #!perl |
2 | use strict; |
3 | use warnings FATAL => 'all'; |
4 | use Test::More qw(no_plan); |
5 | use File::Basename; |
6 | use File::Copy; |
7 | use File::Path; |
55044309 |
8 | use File::Temp qw/tempdir/; |
8a3a89c9 |
9 | use Cwd; |
edff3fdc |
10 | |
11 | BEGIN { use_ok "App::FatPacker", "" } |
12 | |
55044309 |
13 | my $keep = $ENV{'FATPACKER_KEEP_TESTDIR'}; |
14 | my $tempdir = tempdir($keep ? (CLEANUP => 0) : (CLEANUP => 1)); |
edff3fdc |
15 | mkpath([<$tempdir/{lib,fatlib}/t/mod>]); |
16 | |
17 | for(<t/mod/*.pm>) { |
18 | copy $_, "$tempdir/lib/$_" or die "copy failed: $!"; |
19 | } |
20 | |
8a3a89c9 |
21 | my $cwd = getcwd; |
edff3fdc |
22 | chdir $tempdir; |
23 | |
24 | my $fp = App::FatPacker->new; |
25 | my $temp_fh = File::Temp->new; |
26 | select $temp_fh; |
27 | $fp->script_command_file; |
28 | print "1;\n"; |
29 | select STDOUT; |
30 | close $temp_fh; |
31 | |
32 | # Packed, now try using it: |
33 | require $temp_fh; |
34 | |
35 | { |
36 | require t::mod::a; |
37 | no warnings 'once'; |
38 | ok $t::mod::a::foo eq 'bar'; |
39 | } |
8a3a89c9 |
40 | |
41 | # moving away from the dir so it could be deleted |
42 | chdir $cwd; |
55044309 |
43 | |