summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-03-28 02:28:20 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-03-28 02:28:20 +0000
commitfd3835b3e90ede5576a7ad392beef86bf933ce15 (patch)
tree7e48c1da9509d42386cfdfd014b509b84aac4898 /t
parentd98d5fffa337682ca6cac752b32ff55e863a53a0 (diff)
downloadperl-fd3835b3e90ede5576a7ad392beef86bf933ce15.tar.gz
fix bogus OPf_REF context for the BLOCK in C<grep BLOCK @foo>
(sometimes caused bizarreness in the BLOCK) p4raw-id: //depot/perl@3180
Diffstat (limited to 't')
-rwxr-xr-xt/op/grep.t31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/op/grep.t b/t/op/grep.t
new file mode 100755
index 0000000000..45d0e25a27
--- /dev/null
+++ b/t/op/grep.t
@@ -0,0 +1,31 @@
+#!./perl
+
+#
+# grep() and map() tests
+#
+
+print "1..3\n";
+
+$test = 1;
+
+sub ok {
+ my ($got,$expect) = @_;
+ print "# expected [$expect], got [$got]\nnot " if $got ne $expect;
+ print "ok $test\n";
+}
+
+{
+ my @lol = ([qw(a b c)], [], [qw(1 2 3)]);
+ my @mapped = map {scalar @$_} @lol;
+ ok "@mapped", "3 0 3";
+ $test++;
+
+ my @grepped = grep {scalar @$_} @lol;
+ ok "@grepped", "$lol[0] $lol[2]";
+ $test++;
+
+ @grepped = grep { $_ } @mapped;
+ ok "@grepped", "3 3";
+ $test++;
+}
+