80772caddfc0569455f2ccd83c63baeef7e83eee
[p5sagit/Devel-Declare.git] / t / simple.t
1 use strict;
2 use warnings;
3 use Test::More 'no_plan';
4
5 sub method {
6   my ($pack, $name, $sub) = @_;
7   no strict 'refs';
8   *{"${pack}::${name}"} = $sub;
9 }
10
11 use Devel::Declare 'method';
12
13 my ($args1, $args2);
14
15 method bar {
16   $args1 = join(', ', @_);
17 };
18
19 method # blather
20   baz
21   # whee
22 {
23   $args2 = join(', ', @_);
24 };
25
26 __PACKAGE__->bar(qw(1 2));
27 __PACKAGE__->baz(qw(3 4));
28
29 is($args1, 'main, 1, 2', 'Method bar args ok');
30 is($args2, 'main, 3, 4', 'Method baz args ok');