Skip to content

Instantly share code, notes, and snippets.

@colomon
Created March 27, 2010 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colomon/345618 to your computer and use it in GitHub Desktop.
Save colomon/345618 to your computer and use it in GitHub Desktop.
multi sub is(Iterable $got, Iterable $expected, $desc) is export {
my @got;
my @expected;
my $test = True;
loop {
my $a = $got.get;
my $b = $expected.get;
if ($a ~~ EMPTY) || ($b ~~ EMPTY) {
unless ($a ~~ EMPTY) && ($b ~~ EMPTY) {
$test = False;
@got.push($a) if $a !~~ EMPTY;
@expected.push($b) if $b !~~ EMPTY;
}
last;
}
@got.push: $a;
@expected.push: $b;
}
proclaim(?$test, $desc);
if !$test {
my $got_perl = try { @got.perl };
my $expected_perl = try { @expected.perl };
if $got_perl.defined && $expected_perl.defined {
diag " got: $got_perl";
diag "expected: $expected_perl";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment