X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faccessors_ro.t;h=33d3f38a3dfd96a6b6e69ce5c528ff058bcd0198;hb=76427bb1ddcfc2374ae9eb615855adf19069a55b;hp=741d79d923bd5a6a677f7dfad834bc4f5bfa246f;hpb=ba8c183b7c3d71a5b8fcd936916e80a7b87f7961;p=p5sagit%2FClass-Accessor-Grouped.git diff --git a/t/accessors_ro.t b/t/accessors_ro.t index 741d79d..33d3f38 100644 --- a/t/accessors_ro.t +++ b/t/accessors_ro.t @@ -1,7 +1,8 @@ -use Test::More tests => 48; +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 @@ -51,6 +52,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) { @@ -75,22 +80,29 @@ for my $name (sort keys %$test_accessors) { my $ro_regex = $test_accessors->{$name}{is_xs} ? qr/Usage\:.+$name.*\(self\)/ - : qr/cannot alter the value of '\Q$field\E'/ + : qr/$name(:?_accessor)?\Q' cannot alter its value (read-only attribute of class AccessorGroupsRO)/ ; - # die on set via name/alias - throws_ok { - $obj->$name('b'); - } $ro_regex; + SKIP: { + skip "Class::XSAccessor emits broken error messages on 5.10 and earlier", 1 if ( + $test_accessors->{$name}{is_xs} + and + $] < '5.011' + ); + + # die on set via name/alias + throws_ok { + $obj->$name('b'); + } $ro_regex; - throws_ok { - $obj->$alias('b'); - } $ro_regex; + throws_ok { + $obj->$alias('b'); + } $ro_regex; + } # value should be unchanged is($obj->$name, 'a'); is($obj->$alias, 'a'); }; -#important -1; +done_testing unless $::SUBTESTING;