Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid warnings in "is".
  • Loading branch information
colomon committed Dec 19, 2011
1 parent d9cc964 commit d18c193
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Test.pm6
Expand Up @@ -93,13 +93,15 @@ sub is_deeply($a,$b,$c) is export { is $a.perl, $b.perl, $c }
sub is(\$got, \$expected, $tag?) is export {

# avoid comparing twice
my $equal = (~$got) eq (~$expected);
my $sgot = ~($got // '');
my $sexpexted = ~($expected // '');
my $equal = $sgot eq $sexpexted;

$*TEST-BUILDER.ok($equal, $tag);
if !$equal {
$*TEST-BUILDER.note(' Failed test');
$*TEST-BUILDER.note(' got: ' ~ ~$got);
$*TEST-BUILDER.note(' expected: ' ~ ~$expected);
$*TEST-BUILDER.note(" got: $sgot");
$*TEST-BUILDER.note(" expected: $sexpexted");
}
}
sub isnt(Mu $got, Mu $expected, $tag?) is export { $*TEST-BUILDER.ok($got ne $expected, $tag) }
Expand Down

0 comments on commit d18c193

Please sign in to comment.