3 # Try to test fixin. I say "try" because what fixin will actually do
4 # is highly variable from system to system.
7 if( $ENV{PERL_CORE} ) {
9 @INC = ('../lib', 'lib/');
12 unshift @INC, 't/lib/';
19 use Test::More tests => 22;
23 use MakeMaker::Test::Utils;
24 use MakeMaker::Test::Setup::BFD;
26 use ExtUtils::MakeMaker;
32 ok( setup_recurs(), 'setup' );
34 ok( chdir File::Spec->updir );
35 ok( teardown_recurs(), 'teardown' );
38 ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
39 diag("chdir failed: $!");
45 MY->fixin("bin/program");
46 is $/, "foo", '$/ not clobbered';
47 is $\, "bar", '$\ not clobbered';
52 my($code, $test) = @_;
54 my $file = "fixin_test";
55 ok(open(my $fh, ">", $file), "write $file") or diag "Can't write $file: $!";
61 ok(open($fh, "<", $file), "read $file") or diag "Can't read $file: $!";
68 ok !-e $file, "cleaned up $file";
72 # A simple test of fixin
80 unlike $lines[0], qr[/foo/bar/perl], "#! replaced";
81 like $lines[0], qr[ -w\b], "switch retained";
83 # In between might be that "not running under some shell" madness.
85 is $lines[-1], "blah blah blah\n", "Program text retained";
92 #!/foo/bar/perl5.8.8 -w
99 unlike $lines[0], qr[/foo/bar/perl5.8.8], "#! replaced";
100 like $lines[0], qr[ -w\b], "switch retained";
102 # In between might be that "not running under some shell" madness.
104 is $lines[-1], "blah blah blah\n", "Program text retained";
109 # fixin shouldn't pick this up.
117 is join("", @_), <<END;