7 unshift @INC, '../lib';
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 $Is_Dos = $^O eq 'dos';
25 $Is_os2 = $^O eq 'os2';
26 $Is_Cygwin = $^O eq 'cygwin';
27 $PERL = ($Is_MSWin32 ? '.\perl' : './perl');
31 eval '$ENV{"FOO"} = "hi there";'; # check that ENV is inited inside eval
32 if ($Is_MSWin32) { ok 1, `cmd /x /c set FOO` eq "FOO=hi there\n"; }
33 else { ok 1, `echo \$FOO` eq "hi there\n"; }
35 unlink 'ajslkdfpqjsjfk';
37 open(FOO,'ajslkdfpqjsjfk');
39 close FOO; # just mention it, squelch used-only-once
41 if ($Is_MSWin32 || $Is_Dos) {
46 # the next tests are embedded inside system simply because sh spits out
47 # a newline onto stderr when a child process kills itself with SIGINT.
48 system './perl', '-e', <<'END';
50 $| = 1; # command buffering
52 $SIG{"INT"} = "ok3"; kill "INT",$$; sleep 1;
53 $SIG{"INT"} = "IGNORE"; kill "INT",$$; sleep 1; print "ok 4\n";
54 $SIG{"INT"} = "DEFAULT"; kill "INT",$$; sleep 1; print "not ok\n";
57 if (($x = pop(@_)) eq "INT") {
61 print "not ok 3 ($x @_)\n";
69 @val1 = @ENV{keys(%ENV)};
71 ok 5, join(':',@val1) eq join(':',@val2);
75 'foobarbaz' =~ /b(a)r/;
76 ok 7, $` eq 'foo', $`;
77 ok 8, $& eq 'bar', $&;
78 ok 9, $' eq 'baz', $';
83 ok 11, "@a" eq "foo bar baz", "@a";
86 ok 12, "@a" eq "foo,bar,baz", "@a";
92 ok 13, (keys %h)[0] eq "foo\034bar", (keys %h)[0];
97 ok 14, (keys %h)[0] eq 'fooxbar', (keys %h)[0];
101 system qq[$PERL -e "exit(0)"];
103 system qq[$PERL -e "exit(1)"];
106 eval { die "foo\n" };
107 ok 17, $@ eq "foo\n", $@;
114 chomp($wd = `/usr/bin/fullpath -t`);
117 # Cygwin turns the symlink into the real file
122 $wd = Cwd::sys_cwd();
127 my $perl = "$wd/perl";
130 $script = "$wd/show-shebang";
134 $perl = "$wd/perl.exe";
135 $script = "$wd/show-shebang.bat";
150 $script = "./show-shebang";
152 if ($^O eq 'os390' or $^O eq 'posix-bc' or $^O eq 'vmesa') { # no shebang
154 eval 'exec ./perl -S \$0 \${1+"\$\@"}'
158 $s1 = "\$^X is $perl, \$0 is $script\n";
159 ok 19, open(SCRIPT, ">$script"), $!;
160 ok 20, print(SCRIPT $headmaybe . <<EOB . <<'EOF' . $tailmaybe), $!;
163 print "\$^X is $^X, \$0 is $0\n";
165 ok 21, close(SCRIPT), $!;
166 ok 22, chmod(0755, $script), $!;
168 s/\.exe//i if $Is_Dos or $Is_Cygwin or $Is_os2;
169 s{\bminiperl\b}{perl}; # so that test doesn't fail with miniperl
170 s{is perl}{is $perl}; # for systems where $^X is only a basename
172 ok 23, (($Is_MSWin32 || $Is_os2) ? uc($_) eq uc($s1) : $_ eq $s1), " :$_:!=:$s1:";
173 $_ = `$perl $script`;
174 s/\.exe//i if $Is_Dos or $Is_os2;
176 ok 24, (($Is_MSWin32 || $Is_os2) ? uc($_) eq uc($s1) : $_ eq $s1), " :$_:!=:$s1: after `$perl $script`";
177 ok 25, unlink($script), $!;
181 ok 26, $] >= 5.00319, $];
183 ok 28, $^T > 850000000, $^T;
185 if ($Is_VMS || $Is_Dos) {
186 ok "29 # skipped", 1;
187 ok "30 # skipped", 1;
194 ok 29, ($Is_MSWin32 ? (`cmd /x /c set foo 2>NUL` eq "")
195 : (`echo \$foo` eq "\n") );
197 $ENV{NoNeSuCh} = "foo";
199 ok 30, ($Is_MSWin32 ? (`cmd /x /c set NoNeSuCh` eq "NoNeSuCh=foo\n")
200 : (`echo \$NoNeSuCh` eq "foo\n") );
204 local $SIG{'__WARN__'} = sub { print "# @_\nnot " };
209 # test case-insignificance of %ENV (these tests must be enabled only
210 # when perl is compiled with -DENV_IS_CASELESS)
215 ok 32, (scalar(keys(%ENV)) == 1);
216 ok 33, exists($ENV{'FOo'});
217 ok 34, (delete($ENV{'foO'}) eq 'baz');
218 ok 35, (scalar(keys(%ENV)) == 0);
221 ok "32 # skipped: no caseless %ENV support",1;
222 ok "33 # skipped: no caseless %ENV support",1;
223 ok "34 # skipped: no caseless %ENV support",1;
224 ok "35 # skipped: no caseless %ENV support",1;