Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: e0ffb54e5a
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (23 sloc) 0.669 kb
use Test;
use Test::Mock;
plan 8;
class Glass { }
class Party { }
class Pub {
method order_beer($pints) { }
method throw($what) { }
}
my $p = mocked(Pub);
$p.order_beer(2);
$p.order_beer(1);
$p.throw(Party.new);
check-mock($p,
*.called('order_beer', times => 2),
*.called('order_beer', times => 1, with => \(1)),
*.called('order_beer', times => 1, with => \(2)),
*.never-called('order_beer', with => \(10)),
*.called('throw', with => :(Party)),
*.never-called('throw', with => :(Glass)),
*.called('order_beer', times => 2, with => :($ where { $^n < 10 })),
*.never-called('order_beer', with => :($ where { $^n >= 10 })),
);
Jump to Line
Something went wrong with that request. Please try again.