Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add testcase.

  • Loading branch information...
commit 566abd4a122318c83df276e6359ac73ef8af3d55 1 parent 19678cc
@NetPenguin authored
Showing with 54 additions and 0 deletions.
  1. +27 −0 t/07.uninvoked_method.t
  2. +27 −0 t/99.error.t
View
27 t/07.uninvoked_method.t
@@ -0,0 +1,27 @@
+use strict;
+use warnings;
+
+use t::Util qw(expect_fail);
+use Test::More;
+BEGIN {
+ use_ok('Test::EasyMock',
+ qw{
+ create_mock
+ expect
+ replay
+ verify
+ });
+}
+use Test::Exception;
+
+# ----
+# Tests.
+subtest 'expected but not invoke' => sub {
+ my $mock = create_mock();
+ expect($mock->foo);
+ replay($mock);
+ expect_fail { verify($mock) };
+};
+
+# ----
+done_testing;
View
27 t/99.error.t
@@ -0,0 +1,27 @@
+use strict;
+use warnings;
+
+use Test::More;
+BEGIN {
+ use_ok('Test::EasyMock',
+ qw{
+ expect
+ replay
+ reset
+ verify
+ });
+}
+use Test::Exception;
+
+# ----
+# Tests.
+subtest 'is not a mock object.' => sub {
+ my $other = bless {}, '__DUMMY__';
+ dies_ok { expect($other) } 'expect';
+ dies_ok { replay($other) } 'replay';
+ dies_ok { reset($other) } 'reset';
+ dies_ok { verify($other) } 'verify';
+};
+
+# ----
+done_testing;
Please sign in to comment.
Something went wrong with that request. Please try again.