support requires on Mouse::Role.
[gitmo/Mouse.git] / t / 016-trigger.t
index 2925a8e..29406c4 100644 (file)
@@ -1,8 +1,8 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use Test::More tests => 10;
-use Test::Exception;
+use Test::More tests => 11;
+use Mouse::Util ':test';
 
 my @trigger;
 
@@ -20,11 +20,18 @@ do {
     );
 
     ::lives_ok {
-        has error => (
+        has not_error => (
             is => 'ro',
             trigger => sub { },
         );
     } "it's no longer an error to have trigger on a readonly attribute";
+
+    ::throws_ok {
+        has error => (
+            is => 'ro',
+            trigger => [],
+        );
+    } qr/Trigger must be a CODE ref on attribute \(error\)/;
 };
 
 can_ok(Class => 'attr');