3 # Try to test fixin. I say "try" because what fixin will actually do
4 # is highly variable from system to system.
7 unshift @INC, 't/lib/';
13 use Test::More tests => 22;
17 use MakeMaker::Test::Utils;
18 use MakeMaker::Test::Setup::BFD;
20 use ExtUtils::MakeMaker;
26 ok( setup_recurs(), 'setup' );
28 ok( chdir File::Spec->updir );
29 ok( teardown_recurs(), 'teardown' );
32 ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
33 diag("chdir failed: $!");
39 MY->fixin("bin/program");
40 is $/, "foo", '$/ not clobbered';
41 is $\, "bar", '$\ not clobbered';
46 my($code, $test) = @_;
48 my $file = "fixin_test";
49 ok(open(my $fh, ">", $file), "write $file") or diag "Can't write $file: $!";
55 ok(open($fh, "<", $file), "read $file") or diag "Can't read $file: $!";
62 ok !-e $file, "cleaned up $file";
66 # A simple test of fixin
74 unlike $lines[0], qr[/foo/bar/perl], "#! replaced";
75 like $lines[0], qr[ -w\b], "switch retained";
77 # In between might be that "not running under some shell" madness.
79 is $lines[-1], "blah blah blah\n", "Program text retained";
86 #!/foo/bar/perl5.8.8 -w
93 unlike $lines[0], qr[/foo/bar/perl5.8.8], "#! replaced";
94 like $lines[0], qr[ -w\b], "switch retained";
96 # In between might be that "not running under some shell" madness.
98 is $lines[-1], "blah blah blah\n", "Program text retained";
103 # fixin shouldn't pick this up.
111 is join("", @_), <<END;