Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[t/spec/S02-builtin_data_types/keyset.t] added some basic tests

git-svn-id: http://svn.pugscode.org/pugs@25378 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 71b520d93be7e722b032fec376417ce972a05c39 1 parent eb0fa17
masak authored
Showing with 25 additions and 0 deletions.
  1. +25 −0 S02-builtin_data_types/keyset.t
View
25 S02-builtin_data_types/keyset.t
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.