make_ext.pl now generates a Makefile.PL if needed.
[p5sagit/p5-mst-13.2.git] / ext / Attribute-Handlers / t / data_convert.t
1 #!/usr/bin/perl -w
2
3 # Test attribute data conversion using examples from the docs
4
5 BEGIN {
6     if ($ENV{PERL_CORE}) {
7         chdir 't' if -d 't';
8         @INC = '../lib';
9     }
10 }
11
12 use Test::More tests => 8;
13
14 package LoudDecl;
15 use Attribute::Handlers;
16
17 sub Loud :ATTR {
18     my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
19
20     ::is_deeply( $data, $referent->(), *{$symbol}{NAME} );
21 }
22
23
24 sub test1 :Loud(till=>ears=>are=>bleeding) {
25     [qw(till ears are bleeding)]
26 }
27
28 sub test2 :Loud(['till','ears','are','bleeding']) {
29     [[qw(till ears are bleeding)]]
30 }
31
32 sub test3 :Loud(qw/till ears are bleeding/) {
33     [qw(till ears are bleeding)]
34 }
35
36 sub test4 :Loud(qw/my, ears, are, bleeding/) {
37     [('my,', 'ears,', 'are,', 'bleeding')]
38 }
39
40 sub test5 :Loud(till,ears,are,bleeding) {
41     [qw(till ears are bleeding)]
42 }
43
44 sub test6 :Loud(my,ears,are,bleeding) {
45     'my,ears,are,bleeding';
46 }
47
48 sub test7 :Loud(qw/my ears are bleeding) {
49     'qw/my ears are bleeding'; #'
50 }
51
52 sub test8 :Loud("turn it up to 11, man!") {
53     ['turn it up to 11, man!'];
54 }