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",$$;
50 $SIG{"INT"} = "IGNORE"; kill 2,$$; print "ok 4\n";
51 $SIG{"INT"} = "DEFAULT"; kill 2,$$; 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", $@;
110 for (19 .. 25) { ok $_, 1 }
119 $script = "$wd/show-shebang";
120 $s1 = $s2 = "\$^X is $wd/perl, \$0 is $script\n";
122 # Started by ksh, which adds suffixes '.exe' and '.' to perl and script
123 $s2 = "\$^X is $wd/perl.exe, \$0 is $script.\n";
125 ok 19, open(SCRIPT, ">$script"), $!;
126 ok 20, print(SCRIPT <<EOB . <<'EOF'), $!;
129 print "\$^X is $^X, \$0 is $0\n";
131 ok 21, close(SCRIPT), $!;
132 ok 22, chmod(0755, $script), $!;
134 s{\bminiperl\b}{perl}; # so that test doesn't fail with miniperl
135 s{is perl}{is $wd/perl}; # for systems where $^X is only a basename
136 ok 23, $_ eq $s2, ":$_:!=:$s2:";
137 $_ = `$wd/perl $script`;
138 ok 24, $_ eq $s1, ":$_:!=:$s1: after `$wd/perl $script`";
139 ok 25, unlink($script), $!;
143 ok 26, $] >= 5.00319, $];
145 ok 28, $^T > 850000000, $^T;
156 ok 29, ($Is_MSWin32 ? (`cmd /x /c set foo 2>NUL` eq "")
157 : (`echo \$foo` eq "\n") );
159 $ENV{NoNeSuCh} = "foo";
161 ok 30, ($Is_MSWin32 ? (`cmd /x /c set NoNeSuCh` eq "NoNeSuCh=foo\n")
162 : (`echo \$NoNeSuCh` eq "foo\n") );