Skip to content

Commit

Permalink
Change Bag.Str and KeyBag.Str to conform to TimToady's suggestions:
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Mar 27, 2012
1 parent 014f5f8 commit 35ba028
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
9 changes: 3 additions & 6 deletions 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(' ')
Expand Down Expand Up @@ -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";
}

{
Expand Down
9 changes: 3 additions & 6 deletions S02-types/keybag.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 144;
plan 141;

# L<S02/Mutable types/KeyHash of UInt>

Expand Down Expand Up @@ -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";
}

{
Expand Down
2 changes: 1 addition & 1 deletion S02-types/keyset.t
Expand Up @@ -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";
Expand Down

0 comments on commit 35ba028

Please sign in to comment.