8 $SIG{__WARN__} = sub { die "Dying on warning: ", @_ };
12 my ($n, $result, $info) = @_;
18 print "# $info\n" if $info;
22 $Is_MSWin32 = ($^O eq 'MSWin32');
23 $PERL = ($Is_MSWin32 ? '.\perl' : './perl');
27 eval '$ENV{"foo"} = "hi there";'; # check that ENV is inited inside eval
28 if ($Is_MSWin32) { ok 1, `cmd /x /c set foo` eq "foo=hi there\n"; }
29 else { ok 1, `echo \$foo` eq "hi there\n"; }
31 unlink 'ajslkdfpqjsjfk';
33 open(FOO,'ajslkdfpqjsjfk');
35 close FOO; # just mention it, squelch used-only-once
42 # the next tests are embedded inside system simply because sh spits out
43 # a newline onto stderr when a child process kills itself with SIGINT.
44 system './perl', '-e', <<'END';
46 $| = 1; # command buffering
48 $SIG{"INT"} = "ok3"; kill "INT",$$;
49 $SIG{"INT"} = "IGNORE"; kill 2,$$; print "ok 4\n";
50 $SIG{"INT"} = "DEFAULT"; kill 2,$$; print "not ok\n";
53 if (($x = pop(@_)) eq "INT") {
57 print "not ok 3 ($x @_)\n";
65 @val1 = @ENV{keys(%ENV)};
67 ok 5, join(':',@val1) eq join(':',@val2);
71 'foobarbaz' =~ /b(a)r/;
72 ok 7, $` eq 'foo', $`;
73 ok 8, $& eq 'bar', $&;
74 ok 9, $' eq 'baz', $';
79 ok 11, "@a" eq "foo bar baz", "@a";
82 ok 12, "@a" eq "foo,bar,baz", "@a";
88 ok 13, (keys %h)[0] eq "foo\034bar", (keys %h)[0];
93 ok 14, (keys %h)[0] eq 'fooxbar', (keys %h)[0];
97 system qq[$PERL -e "exit(0)"];
99 system qq[$PERL -e "exit(1)"];
102 eval { die "foo\n" };
103 ok 17, $@ eq "foo\n", $@;
109 for (19 .. 25) { ok $_, 1 }
112 if ($^O eq 'qnx' || $^O eq 'amigaos') {
118 $script = "$wd/show-shebang";
119 $s1 = $s2 = "\$^X is $wd/perl, \$0 is $script\n";
121 # Started by ksh, which adds suffixes '.exe' and '.' to perl and script
122 $s2 = "\$^X is $wd/perl.exe, \$0 is $script.\n";
124 ok 19, open(SCRIPT, ">$script"), $!;
125 ok 20, print(SCRIPT <<EOB . <<'EOF'), $!;
128 print "\$^X is $^X, \$0 is $0\n";
130 ok 21, close(SCRIPT), $!;
131 ok 22, chmod(0755, $script), $!;
133 s{\bminiperl\b}{perl}; # so that test doesn't fail with miniperl
134 s{is perl}{is $wd/perl}; # for systems where $^X is only a basename
135 ok 23, $_ eq $s2, ":$_:!=:$s2:";
136 $_ = `$wd/perl $script`;
137 ok 24, $_ eq $s1, ":$_:!=:$s1: after `$wd/perl $script`";
138 ok 25, unlink($script), $!;
142 ok 26, $] >= 5.00319, $];
144 ok 28, $^T > 850000000, $^T;