summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-05-28 04:58:29 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-05-28 04:58:29 +0000
commit8593bda5eaf2f40ae7a609c286d223c8f721fc0d (patch)
tree1e073ef96866a8d08b7c1705857ef8eb6acf00c3 /t
parent71d280e38f6b1166e3ba01f7a839868275eb4b7f (diff)
downloadperl-8593bda5eaf2f40ae7a609c286d223c8f721fc0d.tar.gz
downgrade fatal error on C<"foo@nosucharray.com"> to optional warning
(from Mark-Jason Dominus) p4raw-id: //depot/perl@6122
Diffstat (limited to 't')
-rwxr-xr-xt/base/lex.t41
-rw-r--r--t/pragma/strict-vars11
-rwxr-xr-xt/pragma/strict.t2
-rw-r--r--t/pragma/warn/toke8
-rw-r--r--t/pragma/warnings.t4
5 files changed, 61 insertions, 5 deletions
diff --git a/t/base/lex.t b/t/base/lex.t
index d90d404cac..c7fb0e4cf3 100755
--- a/t/base/lex.t
+++ b/t/base/lex.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..46\n";
+print "1..51\n";
$x = 'x';
@@ -206,3 +206,42 @@ EOT
print "# $@\nnot ok $test\n" if $@;
T '^main:plink:53$', $test++;
}
+
+# tests 47--51 start here
+# tests for new array interpolation semantics:
+# arrays now *always* interpolate into "..." strings.
+# 20000522 MJD (mjd@plover.com)
+{
+ my $test = 47;
+ eval(q(">@nosuch<" eq "><")) || print "# $@", "not ";
+ print "ok $test\n";
+ ++$test;
+
+ # Look at this! This is going to be a common error in the future:
+ eval(q("fred@example.com" eq "fred.com")) || print "# $@", "not ";
+ print "ok $test\n";
+ ++$test;
+
+ # Let's make sure that normal array interpolation still works right
+ # For some reason, this appears not to be tested anywhere else.
+ my @a = (1,2,3);
+ print +((">@a<" eq ">1 2 3<") ? '' : 'not '), "ok $test\n";
+ ++$test;
+
+ # Ditto.
+ eval(q{@nosuch = ('a', 'b', 'c'); ">@nosuch<" eq ">a b c<"})
+ || print "# $@", "not ";
+ print "ok $test\n";
+ ++$test;
+
+ # This isn't actually a lex test, but it's testing the same feature
+ sub makearray {
+ my @array = ('fish', 'dog', 'carrot');
+ *R::crackers = \@array;
+ }
+
+ eval(q{makearray(); ">@R::crackers<" eq ">fish dog carrot<"})
+ || print "# $@", "not ";
+ print "ok $test\n";
+ ++$test;
+}
diff --git a/t/pragma/strict-vars b/t/pragma/strict-vars
index 2ccfef7105..a764fb23d6 100644
--- a/t/pragma/strict-vars
+++ b/t/pragma/strict-vars
@@ -397,3 +397,14 @@ EXPECT
"our" variable $foo redeclared at - line 7.
(Did you mean "local" instead of "our"?)
Name "Foo::foo" used only once: possible typo at - line 9.
+########
+
+# Make sure the strict vars failure still occurs
+# now that the `@i should be written as \@i' failure does not occur
+# 20000522 mjd@plover.com (MJD)
+use strict 'vars';
+no warnings;
+"@i_like_crackers";
+EXPECT
+Global symbol "@i_like_crackers" requires explicit package name at - line 7.
+Execution of - aborted due to compilation errors.
diff --git a/t/pragma/strict.t b/t/pragma/strict.t
index c4d64164e6..167b3604f5 100755
--- a/t/pragma/strict.t
+++ b/t/pragma/strict.t
@@ -19,7 +19,7 @@ my @prgs = () ;
foreach (sort glob("pragma/strict-*")) {
- next if /(~|\.orig)$/;
+ next if /(~|\.orig|,v)$/;
open F, "<$_" or die "Cannot open $_: $!\n" ;
while (<F>) {
diff --git a/t/pragma/warn/toke b/t/pragma/warn/toke
index 8db8027767..64f5368588 100644
--- a/t/pragma/warn/toke
+++ b/t/pragma/warn/toke
@@ -585,3 +585,11 @@ EXPECT
Integer overflow in binary number at - line 5.
Integer overflow in hexadecimal number at - line 8.
Integer overflow in octal number at - line 11.
+########
+# toke.c
+use warnings 'ambiguous';
+"@mjd_previously_unused_array";
+no warnings 'ambiguous';
+"@mjd_previously_unused_array";
+EXPECT
+Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3.
diff --git a/t/pragma/warnings.t b/t/pragma/warnings.t
index 71fb0df972..a551740b17 100644
--- a/t/pragma/warnings.t
+++ b/t/pragma/warnings.t
@@ -26,9 +26,7 @@ else
foreach (@w_files) {
- next if /\.orig$/ ;
-
- next if /(~|\.orig)$/;
+ next if /(~|\.orig|,v)$/;
open F, "<$_" or die "Cannot open $_: $!\n" ;
while (<F>) {