|
1 | 1 | use v6;
|
2 | 2 | use Test;
|
3 | 3 |
|
4 |
| -plan 160; |
| 4 | +plan 171; |
5 | 5 |
|
6 | 6 | # L<S02/Mutable types/KeyHash of UInt>
|
7 | 7 |
|
@@ -67,6 +67,22 @@ sub showkv($x) {
|
67 | 67 | nok $b.exists("farve"), "... and everything is still okay";
|
68 | 68 | }
|
69 | 69 |
|
| 70 | +#?rakudo skip "KeyBag.ACCEPTS NYI" |
| 71 | +{ |
| 72 | + ok (KeyBag.new: <a b c>) ~~ (KeyBag.new: <a b c>), "Identical bags smartmatch with each other"; |
| 73 | + ok (KeyBag.new: <a b c c>) ~~ (KeyBag.new: <a b c c>), "Identical bags smartmatch with each other"; |
| 74 | + nok (KeyBag.new: <b c>) ~~ (KeyBag.new: <a b c>), "Subset does not smartmatch"; |
| 75 | + nok (KeyBag.new: <a b c>) ~~ (KeyBag.new: <a b c c>), "Subset (only quantity different) does not smartmatch"; |
| 76 | + nok (KeyBag.new: <a b c d>) ~~ (KeyBag.new: <a b c>), "Superset does not smartmatch"; |
| 77 | + nok (KeyBag.new: <a b c c c>) ~~ (KeyBag.new: <a b c c>), "Superset (only quantity different) does not smartmatch"; |
| 78 | + nok "a" ~~ (KeyBag.new: <a b c>), "Smartmatch is not element of"; |
| 79 | + ok (KeyBag.new: <a b c>) ~~ KeyBag, "Type-checking smartmatch works"; |
| 80 | + |
| 81 | + ok (set <a b c>) ~~ (KeyBag.new: <a b c>), "Set smartmatches with equivalent KeyBag.new:"; |
| 82 | + nok (set <a a a b c>) ~~ (KeyBag.new: <a a a b c>), "... but not if the Bag has greater quantities"; |
| 83 | + nok (set <a b c>) ~~ KeyBag, "Type-checking smartmatch works"; |
| 84 | +} |
| 85 | + |
70 | 86 | #?rakudo skip ".KeyBag NYI"
|
71 | 87 | {
|
72 | 88 | isa_ok "a".KeyBag, KeyBag, "Str.KeyBag makes a KeyBag";
|
|
0 commit comments