summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-09-17 07:12:14 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-09-17 07:12:14 +0000
commite7bc2a5621ea77bd64cb92ef7a8d65e8ee3f1747 (patch)
tree7d29fe1c71d723d344acf73a6c5943194bd2ae8a /t
parent27e4dad07483235e869104f9b196d7a67912fac0 (diff)
parentb189cfd0f43333790af2622356a29acc5548da01 (diff)
downloadperl-e7bc2a5621ea77bd64cb92ef7a8d65e8ee3f1747.tar.gz
Integrate mainline
p4raw-id: //depot/perlio@12045
Diffstat (limited to 't')
-rw-r--r--t/op/chdir.t68
-rwxr-xr-xt/op/pat.t11
-rwxr-xr-xt/op/stat.t14
-rw-r--r--t/run/kill_perl.t9
4 files changed, 91 insertions, 11 deletions
diff --git a/t/op/chdir.t b/t/op/chdir.t
new file mode 100644
index 0000000000..118895da2b
--- /dev/null
+++ b/t/op/chdir.t
@@ -0,0 +1,68 @@
+BEGIN {
+ # We're not going to chdir() into 't' because we don't know if
+ # chdir() works! Instead, we'll hedge our bets and put both
+ # possibilities into @INC.
+ @INC = ('lib', '../lib');
+}
+
+
+# Might be a little early in the testing process to start using these,
+# but I can't think of a way to write this test without them.
+use Cwd qw(abs_path cwd);
+use File::Spec::Functions qw(:DEFAULT splitdir);
+
+use Test::More tests => 24;
+
+my $cwd = abs_path;
+
+# Let's get to a known position
+SKIP: {
+ skip("Already in t/", 2) if (splitdir(abs_path))[-1] eq 't';
+
+ ok( chdir('t'), 'chdir("t")');
+ is( abs_path, catdir($cwd, 't'), ' abs_path() agrees' );
+}
+
+$cwd = abs_path;
+
+# The environment variables chdir() pays attention to.
+my @magic_envs = qw(HOME LOGDIR SYS$LOGIN);
+
+foreach my $key (@magic_envs) {
+ # We're going to be using undefs a lot here.
+ no warnings 'uninitialized';
+
+ delete @ENV{@magic_envs};
+ local $ENV{$key} = catdir $cwd, 'op';
+
+ if( $key eq 'SYS$LOGIN' && $^O ne 'VMS' ) {
+ # Make sure $ENV{'SYS$LOGIN'} is only honored on VMS.
+ ok( !chdir(), "chdir() w/\$ENV{$key} set" );
+ is( abs_path, $cwd, ' abs_path() agrees' );
+ }
+ else {
+ ok( chdir(), "chdir() w/\$ENV{$key} set" );
+ is( abs_path, $ENV{$key}, ' abs_path() agrees' );
+ chdir($cwd);
+ is( abs_path, $cwd, ' and back again' );
+ }
+
+ # Bug had chdir(undef) being the same as chdir()
+ ok( !chdir(undef), "chdir(undef) w/\$ENV{$key} set" );
+ is( abs_path, $cwd, ' abs_path() agrees' );
+
+ # Ditto chdir('').
+ ok( !chdir(''), "chdir('') w/\$ENV{$key} set" );
+ is( abs_path, $cwd, ' abs_path() agrees' );
+}
+
+{
+ # We're going to be using undefs a lot here.
+ no warnings 'uninitialized';
+
+ # Unset all the environment variables chdir() pay attention to.
+ local @ENV{@magic_envs} = (undef) x @magic_envs;
+
+ ok( !chdir(), 'chdir() w/o any ENV set' );
+ is( abs_path, $cwd, ' abs_path() agrees' );
+}
diff --git a/t/op/pat.t b/t/op/pat.t
index 23d9c85f2b..2042f398d5 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -6,7 +6,7 @@
$| = 1;
-print "1..714\n";
+print "1..715\n";
BEGIN {
chdir 't' if -d 't';
@@ -2009,6 +2009,7 @@ print "ok 683\n" if @a == 9 && "@a" eq "f o o \n $a $b b a r";
print "ok 686\n";
}
+
my $test = 687;
# Force scalar context on the patern match
@@ -2118,3 +2119,11 @@ sub ok ($$) {
$x = "\x9b" . "y";
ok ($x =~ /^[\x{09b}y]{2}$/, "\\x{09b} is to be treated as \\x9b");
}
+
+{
+ # high bit bug -- japhy
+ my $x = "ab\200d";
+ $x =~ /.*?\200/ or print "not ";
+ print "ok 715\n";
+}
+
diff --git a/t/op/stat.t b/t/op/stat.t
index 088c221ed4..dc47ef3885 100755
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -208,14 +208,11 @@ tty_test:
# can be set to skip the tests that need a tty.
unless($ENV{PERL_SKIP_TTY_TEST}) {
if ($Is_MSWin32 || $Is_NetWare) {
- print "ok 36\n";
- print "ok 37\n";
+ print "ok 36 # Skip: $^O\n";
+ print "ok 37 # Skip: $^O\n";
}
else {
- my $TTY = "/dev/tty";
-
- $TTY = "/dev/ttyp0" if $^O eq 'rhapsody';
-
+ my $TTY = $^O eq 'rhapsody' ? "/dev/ttyp0" : "/dev/tty";
if (defined $TTY) {
unless (open(TTY, $TTY)) {
print STDERR "Can't open $TTY--run t/TEST outside of make.\n";
@@ -232,10 +229,7 @@ unless($ENV{PERL_SKIP_TTY_TEST}) {
if (-t) {print "ok 39\n";} else {print "not ok 39\n";}
}
else {
- print "ok 36\n";
- print "ok 37\n";
- print "ok 38\n";
- print "ok 39\n";
+ for (36..39) { print "ok $_ # Skip: PERL_SKIP_TTY_TEST\n" }
}
open(null,"/dev/null");
if (! -t null || -e '/xenix' || $^O eq 'machten' || $Is_MSWin32 || $Is_NetWare)
diff --git a/t/run/kill_perl.t b/t/run/kill_perl.t
index 225208e7f6..9dcd59dc01 100644
--- a/t/run/kill_perl.t
+++ b/t/run/kill_perl.t
@@ -802,3 +802,12 @@ undef foo;
EXPECT
Can't modify constant item in undef operator at - line 1, near "foo;"
Execution of - aborted due to compilation errors.
+######## (?{...}) compilation bounces on PL_rs
+-0
+{
+ /(?{ $x })/;
+ # {
+}
+BEGIN { print "ok\n" }
+EXPECT
+ok