Convert all tests to done_testing.
[gitmo/Moose.git] / t / 070_native_traits / 209_trait_code.t
index 832f48b..842b323 100644 (file)
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 2;
+use Test::More;
 
 {
     package Thingy;
@@ -14,11 +14,25 @@ use Test::More tests => 2;
         required => 1,
         handles => { 'invoke_callback' => 'execute' },
     );
+
+    has multiplier => (
+        traits   => ['Code'],
+        is       => 'ro',
+        isa      => 'CodeRef',
+        required => 1,
+        handles  => { 'multiply' => 'execute' },
+    );
 }
 
 my $i = 0;
-my $thingy = Thingy->new(callback => sub { ++$i });
+my $thingy = Thingy->new(
+    callback => sub { ++$i },
+    multiplier => sub { $_[0] * 2 }
+);
 
 is($i, 0);
 $thingy->invoke_callback;
 is($i, 1);
+is($thingy->multiply(3), 6);
+
+done_testing;