lexsub.t revision 1.1.1.1
1use Test::More tests => 4; 2use XS::APItest; 3 4 5sub fribbler { 2*shift } 6{ 7 BEGIN { lexical_import fribbler => sub { 3*shift } } 8 is fribbler(15), 45, 'lexical subs via pad_add_name'; 9} 10is fribbler(15), 30, 'XS-allocated lexical subs falling out of scope'; 11 12{ 13 BEGIN { lexical_import fribbler => sub { 3*shift } } 14 is fribbler(15), 45, 'lexical subs via pad_add_name'; 15 no warnings; 16 use feature 'lexical_subs'; 17 our sub fribbler; 18 is fribbler(15), 30, 'our sub overrides XS-registered lexical sub'; 19} 20