X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faccessors_wo.t;h=e80111850fc5c8a882936af62f16ecac2d9d2117;hb=76427bb1ddcfc2374ae9eb615855adf19069a55b;hp=a4bab8ef471be9bacafa74dccf3ccd6407bb6f54;hpb=ba8c183b7c3d71a5b8fcd936916e80a7b87f7961;p=p5sagit%2FClass-Accessor-Grouped.git diff --git a/t/accessors_wo.t b/t/accessors_wo.t index a4bab8e..e801118 100644 --- a/t/accessors_wo.t +++ b/t/accessors_wo.t @@ -1,7 +1,8 @@ -use Test::More tests => 38; +use Test::More; use Test::Exception; use strict; use warnings; +no warnings 'once'; use lib 't/lib'; # we test the pure-perl versions only, but allow overrides @@ -50,6 +51,10 @@ my $test_accessors = { lr2name => { custom_field => "lr2'field", }, + fieldname_torture => { + custom_field => join ('', map { chr($_) } (0..255) ), + is_xs => $use_xs, + }, }; for my $name (sort keys %$test_accessors) { @@ -72,18 +77,25 @@ for my $name (sort keys %$test_accessors) { my $wo_regex = $test_accessors->{$name}{is_xs} ? qr/Usage\:.+$name.*\(self, newvalue\)/ - : qr/cannot access the value of '\Q$field\E'/ + : qr/$name(:?_accessor)?\Q' cannot access its value (write-only attribute of class AccessorGroupsWO)/ ; # die on get via name/alias - throws_ok { - $obj->$name; - } $wo_regex; - - throws_ok { - $obj->$alias; - } $wo_regex; + SKIP: { + skip "Class::XSAccessor emits broken error messages on 5.10 and earlier", 1 if ( + $test_accessors->{$name}{is_xs} + and + $] < '5.011' + ); + + throws_ok { + $obj->$name; + } $wo_regex; + + throws_ok { + $obj->$alias; + } $wo_regex; + } }; -# important -1; \ No newline at end of file +done_testing unless $::SUBTESTING;