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 $Is_VMS = $^O eq 'VMS';
24 $PERL = ($Is_MSWin32 ? '.\perl' : './perl');
28 eval '$ENV{"foo"} = "hi there";'; # check that ENV is inited inside eval
29 if ($Is_MSWin32) { ok 1, `cmd /x /c set foo` eq "foo=hi there\n"; }
30 else { ok 1, `echo \$foo` eq "hi there\n"; }
32 unlink 'ajslkdfpqjsjfk';
34 open(FOO,'ajslkdfpqjsjfk');
36 close FOO; # just mention it, squelch used-only-once
43 # the next tests are embedded inside system simply because sh spits out
44 # a newline onto stderr when a child process kills itself with SIGINT.
45 system './perl', '-e', <<'END';
47 $| = 1; # command buffering
49 $SIG{"INT"} = "ok3"; kill "INT",$$; sleep 1;
50 $SIG{"INT"} = "IGNORE"; kill "INT",$$; sleep 1; print "ok 4\n";
51 $SIG{"INT"} = "DEFAULT"; kill "INT",$$; sleep 1; print "not ok\n";
54 if (($x = pop(@_)) eq "INT") {
58 print "not ok 3 ($x @_)\n";
66 @val1 = @ENV{keys(%ENV)};
68 ok 5, join(':',@val1) eq join(':',@val2);
72 'foobarbaz' =~ /b(a)r/;
73 ok 7, $` eq 'foo', $`;
74 ok 8, $& eq 'bar', $&;
75 ok 9, $' eq 'baz', $';
80 ok 11, "@a" eq "foo bar baz", "@a";
83 ok 12, "@a" eq "foo,bar,baz", "@a";
89 ok 13, (keys %h)[0] eq "foo\034bar", (keys %h)[0];
94 ok 14, (keys %h)[0] eq 'fooxbar', (keys %h)[0];
98 system qq[$PERL -e "exit(0)"];
100 system qq[$PERL -e "exit(1)"];
103 eval { die "foo\n" };
104 ok 17, $@ eq "foo\n", $@;
116 my $perl = "$wd/perl";
119 $script = "$wd/show-shebang";
122 $perl = "$wd\\perl.exe";
123 $script = "$wd\\show-shebang.bat";
137 $s1 = $s2 = "\$^X is $perl, \$0 is $script\n";
139 # Started by ksh, which adds suffixes '.exe' and '.' to perl and script
140 $s2 = "\$^X is $wd/perl.exe, \$0 is $script.\n";
142 ok 19, open(SCRIPT, ">$script"), $!;
143 ok 20, print(SCRIPT $headmaybe . <<EOB . <<'EOF' . $tailmaybe), $!;
146 print "\$^X is $^X, \$0 is $0\n";
148 ok 21, close(SCRIPT), $!;
149 ok 22, chmod(0755, $script), $!;
151 s{\bminiperl\b}{perl}; # so that test doesn't fail with miniperl
152 s{is perl}{is $perl}; # for systems where $^X is only a basename
153 ok 23, ($Is_MSWin32 ? uc($_) eq uc($s2) : $_ eq $s2), ":$_:!=:$s2:";
154 $_ = `$perl $script`;
155 ok 24, ($Is_MSWin32 ? uc($_) eq uc($s1) : $_ eq $s1), ":$_:!=:$s1: after `$perl $script`";
156 ok 25, unlink($script), $!;
160 ok 26, $] >= 5.00319, $];
162 ok 28, $^T > 850000000, $^T;
173 ok 29, ($Is_MSWin32 ? (`cmd /x /c set foo 2>NUL` eq "")
174 : (`echo \$foo` eq "\n") );
176 $ENV{NoNeSuCh} = "foo";
178 ok 30, ($Is_MSWin32 ? (`cmd /x /c set NoNeSuCh` eq "NoNeSuCh=foo\n")
179 : (`echo \$NoNeSuCh` eq "foo\n") );