Skip to content

Commit

Permalink
[t/spec/S02-builtin_data_types/keyset.t] added some basic tests
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@25378 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
masak committed Feb 18, 2009
1 parent eb0fa17 commit 71b520d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions S02-builtin_data_types/keyset.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use v6;
use Test;
plan 7;

# TODO: Smartlink

# A KeySet is a KeyHash of Bool, i.e. the values are Bool

{
my %h is KeySet;

%h = (a => True, b => False, c => True);
is +%h.elems, 2, 'Inititalization worked';
lives_ok { %h<c> = 0 }, 'can set an item to 0';
is %h.elems, 1, '... and an item is gone';
is %h.keys.join(''), 'a', '... and the right one is gone';
%h<c>++;
is %h.keys.sort.join(''), 'ac', '++ on an item reinstates it';
%h<a>--;
is ~%h.keys, 'c', '-- removes items';
%h<b>--;
is ~%h.keys, 'c', '... but only if they were there from the beginning';
}

# vim: ft=perl6

0 comments on commit 71b520d

Please sign in to comment.