| 1 |
#!/usr/bin/perl -w |
| 2 |
|
| 3 |
# Test attribute data conversion using examples from the docs |
| 4 |
|
| 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']) { |
| 22 |
[[qw(till ears are bleeding)]] |
| 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 |
|
| 37 |
sub test6 :Loud(my,ears,are,bleeding) { |
| 38 |
'my,ears,are,bleeding'; |
| 39 |
} |
| 40 |
|
| 41 |
sub test7 :Loud(qw/my ears are bleeding) { |
| 42 |
'qw/my ears are bleeding'; #' |
| 43 |
} |
| 44 |
|
| 45 |
sub test8 :Loud("turn it up to 11, man!") { |
| 46 |
['turn it up to 11, man!']; |
| 47 |
} |