Skip to content

Commit 52f326b

Browse files
kiwiroyhaarg
authored andcommitted
test wrap array prototype
1 parent 4276805 commit 52f326b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

t/141-prototype.t

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,29 @@ use Class::Method::Modifiers;
8080
'warnings controllable via warning pragma';
8181
}
8282

83+
{
84+
my $around;
85+
86+
require List::Util;
87+
List::Util->import('sum');
88+
my $wrap_sum = sub :prototype(@) {
89+
my $orig = shift;
90+
$around = @_;
91+
return 2 * $orig->(@_);
92+
};
93+
94+
95+
my @warn;
96+
{
97+
local $SIG{__WARN__} = sub { push @warn, @_ };
98+
around sum => $wrap_sum;
99+
}
100+
101+
is eval q{sum(11, 1, 4, 5, 9)}, 60,
102+
'result from around xs function';
103+
is $around, 5, 'prototype @ wrapped';
104+
is 0+@warn, 0, 'no warnings';
105+
}
106+
83107
done_testing;
84108
# vim: set ts=8 sts=4 sw=4 tw=115 et :

0 commit comments

Comments
 (0)