summaryrefslogtreecommitdiff
path: root/lib/if.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2003-11-29 20:53:23 +0000
committerNicholas Clark <nick@ccl4.org>2003-11-29 20:53:23 +0000
commit2f761939c78ba722e65a7f4b11072697cd8b1848 (patch)
tree642a1dfc6e9daaa8ac2837fc9838332c083da059 /lib/if.t
parent66b6773e238d515b739774e0d4f0e37f0f95d2b5 (diff)
downloadperl-2f761939c78ba722e65a7f4b11072697cd8b1848.tar.gz
Integrate if.pm 0.0401
Needed to edit the test file as t/TEST can't cope with extra output lines as produced by 0.0401's if.t p4raw-id: //depot/perl@21814
Diffstat (limited to 'lib/if.t')
-rw-r--r--lib/if.t26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/if.t b/lib/if.t
index 61cc4b2630..d17ff51806 100644
--- a/lib/if.t
+++ b/lib/if.t
@@ -1,15 +1,26 @@
#!./perl
BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib';
+ chdir 't' and @INC = '../lib' if -f 't/TEST';
}
-use Test::More tests => 6;
+my $t = 1;
+print "1..5\n";
+sub ok {
+ print "not " unless shift;
+ print "ok $t # ", shift, "\n";
+ $t++;
+}
my $v_plus = $] + 1;
my $v_minus = $] - 1;
+unless (eval 'use open ":std"; 1') {
+ # pretend that open.pm is present
+ $INC{'open.pm'} = 'open.pm';
+ eval 'sub open::foo{}'; # Just in case...
+}
+
ok( eval "use if ($v_minus > \$]), strict => 'subs'; \${'f'} = 12" eq 12,
'"use if" with a false condition, fake pragma');
@@ -24,8 +35,7 @@ ok( (not defined eval "use if ($v_plus > \$]), strict => 'refs'; \${'f'} = 12"
and $@ =~ /while "strict refs" in use/),
'"use if" with a true condition and a pragma');
-ok( eval "use if 1, Cwd; cwd() || 1;",
- '"use if" with a true condition, module, no arguments, exports');
-
-ok( eval "use if qw/ 1 if 1 strict subs /; \${'f'} = 12" eq 12,
- '"use if" with a module named after keyword');
+# Old version had problems with the module name `open', which is a keyword too
+# Use 'open' =>, since pre-5.6.0 could interpret differently
+ok( (eval "use if ($v_plus > \$]), 'open' => IN => ':crlf'; 12" || 0) eq 12,
+ '"use if" with open');