Commit | Line | Data |
7f0eb64d |
1 | #!/usr/bin/perl -w |
2 | |
3 | # Test attribute data conversion using examples from the docs |
4 | |
7f0eb64d |
5 | use Test::More tests => 8; |
6 | |
7 | package LoudDecl; |
8 | use Attribute::Handlers; |
9 | |
10 | sub Loud :ATTR { |
11 | my ($package, $symbol, $referent, $attr, $data, $phase) = @_; |
12 | |
13 | ::is_deeply( $data, $referent->(), *{$symbol}{NAME} ); |
14 | } |
15 | |
16 | |
17 | sub test1 :Loud(till=>ears=>are=>bleeding) { |
18 | [qw(till ears are bleeding)] |
19 | } |
20 | |
21 | sub test2 :Loud(['till','ears','are','bleeding']) { |
2560d050 |
22 | [[qw(till ears are bleeding)]] |
7f0eb64d |
23 | } |
24 | |
25 | sub test3 :Loud(qw/till ears are bleeding/) { |
26 | [qw(till ears are bleeding)] |
27 | } |
28 | |
29 | sub test4 :Loud(qw/my, ears, are, bleeding/) { |
30 | [('my,', 'ears,', 'are,', 'bleeding')] |
31 | } |
32 | |
33 | sub test5 :Loud(till,ears,are,bleeding) { |
34 | [qw(till ears are bleeding)] |
35 | } |
36 | |
1313c7b1 |
37 | sub test6 :Loud(my,ears,are,bleeding) { |
38 | 'my,ears,are,bleeding'; |
7f0eb64d |
39 | } |
40 | |
1313c7b1 |
41 | sub test7 :Loud(qw/my ears are bleeding) { |
42 | 'qw/my ears are bleeding'; #' |
43 | } |
7f0eb64d |
44 | |
1313c7b1 |
45 | sub test8 :Loud("turn it up to 11, man!") { |
2560d050 |
46 | ['turn it up to 11, man!']; |
1313c7b1 |
47 | } |