Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test: item @arr; item %hash
  • Loading branch information
dwarring committed Jun 17, 2014
1 parent 26c1a2b commit cf1c647
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion S03-operators/context.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 32;
plan 36;

# L<S03/List prefix precedence/The list contextualizer>

Expand Down Expand Up @@ -56,6 +56,16 @@ plan 32;
is((item $a, $b), @array, 'item($a, $b) is the same as <<$a $b>> in an array');
}

{
my @a = 1, 2;
my %b = 'x' => 42;

is_deeply [@a], [1, 2], '@array flattening';
is_deeply [item @a], [[1, 2]], 'item @array non-flattening';
is_deeply [%b], ['x' => 42], '%hash flattening';
is_deeply [item %b], [{'x' => 42}], 'item %hash non-flattening';
}

{
# Most of these tests pass in Rakudo, but we must compare with
# eqv instead of eq, since the order of hashes is not guaranteed
Expand Down

0 comments on commit cf1c647

Please sign in to comment.