Skip to content

Commit

Permalink
Add some hash multislice recursion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Oct 19, 2020
1 parent df21e63 commit b2a0fe6
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion S32-hash/multislice-6e.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use v6.e.PREVIEW;
use Test;

plan 527;
plan 535;

# Testing hash multislices, aka %h{a;b;c} and associated adverbs

Expand Down Expand Up @@ -362,4 +362,25 @@ for
}
}

# make sure recursion works
{
my %hash;
is-deeply (%hash{<a b>;"c"} = 42,666), (42,666),
'did assignment to non-existing hashes return the assigned values';
is-deeply %hash, { a => { c => 42 }, b => { c => 666 } },
'did initialization work';
is-deeply (%hash{<a b>;"c"} = 777, 888), (777,888),
'did assignment return the assigned values';
is-deeply %hash, { a => { c => 777 }, b => { c => 888 } },
'did the hash get changed correctly';
is-deeply (%hash{<a b>;"c"}:delete), (777,888),
'did deletion return the expected values';
is-deeply %hash, { a => { }, b => { } },
'did the hash get changed correctly';
is-deeply (%hash{<a b>;"d"} = 333, 444), (333,444),
'did assignment to non-existing keys return the assigned values';
is-deeply %hash, { a => { d => 333 }, b => { d => 444 } },
'did the hash get changed correctly';
}

# vim: expandtab shiftwidth=4

0 comments on commit b2a0fe6

Please sign in to comment.