Permalink
Browse files

Add tests for with argument.

  • Loading branch information...
1 parent 6ba2411 commit e0ffb54e5a163ecbf5c5438c858c3cf88625d0b3 @jnthn committed Jul 4, 2010
Showing with 28 additions and 0 deletions.
  1. +28 −0 t/with.t
View
28 t/with.t
@@ -0,0 +1,28 @@
+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 })),
+);

0 comments on commit e0ffb54

Please sign in to comment.