Skip to content

Commit

Permalink
[gsoc_spectest] added tests for pick(*). (Added 2 tests)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@20700 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
Auzon authored and Auzon committed Jun 7, 2008
1 parent 1481bc5 commit f70bb14
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion S29-list/pick.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 11;
plan 13;

=begin description
Expand Down Expand Up @@ -38,6 +38,20 @@ is eval('pick(2, @arr)'), <z z>, 'sub pick with $num < +@values';
is eval('pick(4, @arr)'), <z z z>, 'sub pick with $num > +@values';
is eval('pick(4, :repl, @arr)'), <z z z z>, 'sub pick(:repl) with $num > +@values';

ok(<a b c d>.pick(*).sort === <a b c d>, 'pick(*) returns all the items in the array (but maybe not in order)');

# There should be a better way to write this
{
my $passed = 0;
my @items = <s o m e i t e m s>;
for (1 .. 10) {
if(@items.pick(*) !=== @items) {
$passed = 1; last;
}
}
ok($passed, 'pick(*) returned the items of the array in a random order');
}

my $c = 0;
my @value = gather {
eval '
Expand Down

0 comments on commit f70bb14

Please sign in to comment.