Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sneek some Hash.append tests into S32-hash/push.t
  • Loading branch information
moritz committed Oct 17, 2015
1 parent ad5e410 commit 7848937
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion S32-hash/push.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 7;
plan 10;

# L<S32::Containers/Hash/"Like hash assignment insofar">

Expand Down Expand Up @@ -34,4 +34,22 @@ my %ref2 = (a => [1, 4, 5], b => 2, c => 3);
is-deeply %gg, { 5 => 'bar' }, 'Hash.push works pushing a non-Str-keyed Pair';
}

{
my %a = :a(1), :b(2, 3), :c[4, 5], :d(6);
my %to-append = :a('X'), :b('Y'), :c('Z');
%a.append(%to-append);
is-deeply %a, %( :a[1, 'X'], :b[2, 3, 'Y'], :c[4, 5, 'Z'], :d(6) ),
'Hash.apend general functionailty';
}

{
my %a = :a[1, 2];
my %p = :a[1, 2];

%p.push( %( :a[3, 4] ) );
%a.append( %( :a[3, 4] ) );
is-deeply %p, %( :a[1, 2, [3, 4]] ), 'Hash.push pushes to array elements';
is-deeply %a, %( :a[1, 2, 3, 4] ), 'Hash.append appends to array elements';
}

# vim: ft=perl6

0 comments on commit 7848937

Please sign in to comment.