diff options
Diffstat (limited to 'contrib/perl5/t/op/grep.t')
-rwxr-xr-x | contrib/perl5/t/op/grep.t | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/contrib/perl5/t/op/grep.t b/contrib/perl5/t/op/grep.t deleted file mode 100755 index 3a7f8ad..0000000 --- a/contrib/perl5/t/op/grep.t +++ /dev/null @@ -1,99 +0,0 @@ -#!./perl - -# -# grep() and map() tests -# - -print "1..27\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++; -} - -{ - print map({$_} ("ok $test\n")); - $test++; - print map - ({$_} ("ok $test\n")); - $test++; - print((map({a => $_}, ("ok $test\n")))[0]->{a}); - $test++; - print((map - ({a=>$_}, - ("ok $test\n")))[0]->{a}); - $test++; - print map { $_ } ("ok $test\n"); - $test++; - print map - { $_ } ("ok $test\n"); - $test++; - print((map {a => $_}, ("ok $test\n"))[0]->{a}); - $test++; - print((map - {a=>$_}, - ("ok $test\n"))[0]->{a}); - $test++; - my $x = "ok \xFF\xFF\n"; - print map($_&$x,("ok $test\n")); - $test++; - print map - ($_ & $x, ("ok $test\n")); - $test++; - print map { $_ & $x } ("ok $test\n"); - $test++; - print map - { $_&$x } ("ok $test\n"); - $test++; - - print grep({$_} ("ok $test\n")); - $test++; - print grep - ({$_} ("ok $test\n")); - $test++; - print grep({a => $_}->{a}, ("ok $test\n")); - $test++; - print grep - ({a => $_}->{a}, - ("ok $test\n")); - $test++; - print grep { $_ } ("ok $test\n"); - $test++; - print grep - { $_ } ("ok $test\n"); - $test++; - print grep {a => $_}->{a}, ("ok $test\n"); - $test++; - print grep - {a => $_}->{a}, - ("ok $test\n"); - $test++; - print grep($_&"X",("ok $test\n")); - $test++; - print grep - ($_&"X", ("ok $test\n")); - $test++; - print grep { $_ & "X" } ("ok $test\n"); - $test++; - print grep - { $_ & "X" } ("ok $test\n"); - $test++; -} |