]> git.vpit.fr Git - perl/modules/with.git/blob - 13-scope.t
8a9b4c81e5f429ff638ff24b2bb24975f85b1369
[perl/modules/with.git] / 13-scope.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More 'no_plan';
7
8 sub bait { ok !$_[0], 'object shouldn\'t be called' }
9 sub with::Mock::bait { ok $_[1], 'object should be called' }
10
11 my $obj = bless {}, 'with::Mock';
12
13 sub alpha {
14  use with \$obj;
15  bait 1;
16 }
17
18 bait 0;
19
20 sub beta {
21  bait 0;
22 }
23
24 sub main::gamma { bait 0 }