1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#!/usr/bin/perl
use v5.18;
use warnings;
use Test2::V0;
use Object::Pad 0.800;
class Counter {
field $count;
method inc { $count++ };
method make_incrsub {
return sub { $count++ };
}
method count { $count }
}
{
my $counter = Counter->new;
my $inc = $counter->make_incrsub;
$inc->();
$inc->();
is( $counter->count, 2, '->count after invoking incrsub' );
}
# RT132249
{
class Widget {
field $_menu;
method popup_menu {
my $on_activate = sub { undef $_menu };
}
method on_mouse {
}
}
# If we got to here without crashing then the test passed
pass( 'RT132249 did not cause a crash' );
}
done_testing;
|