$| = 1;
BEGIN { require './test.pl' }
-plan tests => 4982;
+plan tests => 5037;
use Scalar::Util qw(tainted);
# note: this is testing unary qr, not binary =~
$subs{qr} = '(qr/%s/)';
push @tests, [ "abc", '"abc" =~ (%s)', '(qr)', '("")', [ 1, 2, 0 ], 0 ];
+ push @tests, [ chr 256, 'chr(256) =~ (%s)', '(qr)', '("")',
+ [ 1, 2, 0 ], 0 ];
$e = '"abc" ~~ (%s)';
$subs{'~~'} = $e;
$subs{'%{}'} = '%s';
push @tests, [ {qw(a 1 b 2 c 3)}, 'join "", sort keys %%{%s}',
- '(%{})', undef, [ 1, 2, 0 ], 0 ];
+ '(%{})', undef, [ 1, 1, 0 ], 0 ];
$subs{'&{}'} = '%s';
push @tests, [ sub {99}, 'do {&{%s} for 1,2}',
use overload '+' => 'justice';
eval {bless[]};
::like $@, qr/^Can't resolve method "justice" overloading "\+" in p(?x:
- )ackage "overload" at /,
+ )ackage "Justus" at /,
'Error message when explicitly named overload method does not exist';
package JustUs;
"JustUs"->${\"(+"};
eval {bless []};
::like $@, qr/^Stub found while resolving method "\?{3}" overloadin(?x:
- )g "\+" in package "overload" at /,
+ )g "\+" in package "JustUs" at /,
'Error message when sub stub is encountered';
}
+{ # undefining the overload stash -- KEEP THIS TEST LAST
+ package ant;
+ use overload '+' => 'onion';
+ $_ = \&overload::nil;
+ undef %overload::;
+ bless[];
+ ::ok(1, 'no crash when undefining %overload::');
+}
+
# EOF