use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More tests => 12;
use Test::Exception;
BEGIN {
}
+{
+ {
+ package OverloadedStr;
+ use Moose;
+ use overload '""' => sub { 'this is *not* a string' };
+
+ has 'a_str' => ( isa => 'Str' , is => 'rw' );
+ }
+
+ my $moose_obj = OverloadedStr->new;
+
+ is($moose_obj->a_str( 'foobar' ), 'foobar', 'setter took string');
+ ok($moose_obj, 'this is a *not* a string');
+
+ throws_ok {
+ $moose_obj->a_str( $moose_obj )
+ } qr/Attribute \(a_str\) does not pass the type constraint \(Str\) with OverloadedStr\=HASH\(.*?\)/, '... dies without overloading the string';
+
+}
+
+
+