add $_ aliasing
[p5sagit/Object-Tap.git] / t / 01basic.t
1 use strict;
2 use warnings FATAL => 'all';
3 use Test::More qw(no_plan);
4 use Object::Tap;
5
6 my $tapped;
7
8 sub Foo::bar { $tapped = join(' ', @_) }
9
10 is(Foo->$_tap(sub { $_[0]->bar($_[1]) }, 'one'), 'Foo', 'invocant returned');
11
12 is($tapped, 'Foo one', 'subref tap');
13
14 is(Foo->$_tap(bar => 'two'), 'Foo', 'invocant returned');
15
16 is($tapped, 'Foo two', 'method name tap');
17
18 Foo->$_tap(sub { is($_[0], $_, '$_ aliased to object') });