Skip to content
Browse files

Change Bag.Str and KeyBag.Str to conform to TimToady's suggestions:

  • Loading branch information...
1 parent 014f5f8 commit 35ba02877e20f5b1321799a60a301255d24ca574 @colomon colomon committed
Showing with 7 additions and 13 deletions.
  1. +3 −6 S02-types/bag.t
  2. +3 −6 S02-types/keybag.t
  3. +1 −1 S02-types/keyset.t
View
9 S02-types/bag.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 106;
+plan 103;
sub showkv($x) {
$x.keys.sort.map({ $^k ~ ':' ~ $x{$^k} }).join(' ')
@@ -162,14 +162,11 @@ sub showkv($x) {
}
{
- my $b = bag { foo => 10000000000, bar => 17, baz => 42 };
+ my $b = bag { foo => 2, bar => 3, baz => 1 };
my $s;
lives_ok { $s = $b.Str }, ".Str lives";
isa_ok $s, Str, "... and produces a string";
- ok $s.chars < 1000, "... of reasonable length";
- ok $s ~~ /foo/, "... which mentions foo";
- ok $s ~~ /bar/, "... which mentions bar";
- ok $s ~~ /baz/, "... which mentions baz";
+ is $s.split(" ").sort.join(" "), "bar bar bar baz foo foo", "... which only contains bar baz and foo with the proper counts and separated by spaces";
}
{
View
9 S02-types/keybag.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 144;
+plan 141;
# L<S02/Mutable types/KeyHash of UInt>
@@ -176,14 +176,11 @@ sub showkv($x) {
}
{
- my $b = KeyBag.new({ foo => 10000000000, bar => 17, baz => 42 });
+ my $b = KeyBag.new({ foo => 2, bar => 3, baz => 1 });
my $s;
lives_ok { $s = $b.Str }, ".Str lives";
isa_ok $s, Str, "... and produces a string";
- ok $s.chars < 1000, "... of reasonable length";
- ok $s ~~ /foo/, "... which mentions foo";
- ok $s ~~ /bar/, "... which mentions bar";
- ok $s ~~ /baz/, "... which mentions baz";
+ is $s.split(" ").sort.join(" "), "bar bar bar baz foo foo", "... which only contains bar baz and foo with the proper counts and separated by spaces";
}
{
View
2 S02-types/keyset.t
@@ -164,7 +164,7 @@ sub showset($s) { $s.keys.sort.join(' ') }
}
{
- my $s = set <foo bar baz>;
+ my $s = KeySet.new(<foo bar baz>);
lives_ok { $s = $s.Str }, ".Str lives";
isa_ok $s, Str, "... and produces a string";
is $s.split(" ").sort.join(" "), "bar baz foo", "... which only contains bar baz and foo separated by spaces";

0 comments on commit 35ba028

Please sign in to comment.
Something went wrong with that request. Please try again.