Allow overloading on arguments to native trait methods
[gitmo/Moose.git] / t / 070_native_traits / 070_trait_string.t
index 1f64eb2..d3029b7 100644 (file)
@@ -3,8 +3,11 @@
 use strict;
 use warnings;
 
+use lib 't/lib';
+
 use Moose ();
 use Moose::Util::TypeConstraints;
+use NoInlineAttribute;
 use Test::More;
 use Test::Exception;
 use Test::Moose;
@@ -40,9 +43,13 @@ use Test::Moose;
             superclasses => ['Moose::Object'],
         );
 
+        my @traits = 'String';
+        push @traits, 'NoInlineAttribute'
+            if delete $attr{no_inline};
+
         $class->add_attribute(
             _string => (
-                traits  => ['String'],
+                traits  => \@traits,
                 is      => 'rw',
                 isa     => 'Str',
                 default => q{},
@@ -59,6 +66,8 @@ use Test::Moose;
 {
     run_tests(build_class);
     run_tests( build_class( lazy => 1, default => q{} ) );
+    run_tests( build_class( trigger => sub { } ) );
+    run_tests( build_class( no_inline => 1 ) );
 
     # Will force the inlining code to check the entire hashref when it is modified.
     subtype 'MyStr', as 'Str', where { 1 };
@@ -225,8 +234,8 @@ sub run_tests {
             'substr throws an error when first argument is not an integer';
 
         throws_ok { $obj->substr( 1, {} ) }
-        qr/The second argument passed to substr must be a positive integer/,
-            'substr throws an error when second argument is not a positive integer';
+        qr/The second argument passed to substr must be an integer/,
+            'substr throws an error when second argument is not an integer';
 
         throws_ok { $obj->substr( 1, 2, {} ) }
         qr/The third argument passed to substr must be a string/,