summaryrefslogtreecommitdiffstats
path: root/t/10-inlining.t
blob: cb1b8d853bc5b5203650500ff03c53e3faf8c5ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;

{
    package Foo;
    use Moose;
    use Bread::Board::Declare;

    has foo => (
        reader    => 'get_foo',
        writer    => 'set_foo',
        accessor  => 'foo',
        predicate => 'has_foo',
        clearer   => 'clear_foo',
        value     => 'foo',
    );

    has bool => (
        traits  => ['Bool'],
        isa     => 'Bool',
        value   => 0,
        handles => {
            bool_unset  => 'unset',
            bool_set    => 'set',
            bool_not    => 'not',
            bool_toggle => 'toggle',
        },
    );

    has string => (
        traits  => ['String'],
        isa     => 'Str',
        value   => '',
        default => '', # XXX: ugh, needed because of the default_default stuff
        handles => {
            string_prepend => 'prepend',
            string_chop    => 'chop',
            string_substr  => 'substr',
            string_match   => 'match',
            string_length  => 'length',
            string_inc     => 'inc',
            string_append  => 'append',
            string_clear   => 'clear',
            string_chomp   => 'chomp',
            string_replace => 'replace',
        },
    );

    has hash => (
        traits  => ['Hash'],
        isa     => 'HashRef',
        block   => sub { {} },
        handles => {
            hash_delete   => 'delete',
            hash_exists   => 'exists',
            hash_values   => 'values',
            hash_get      => 'get',
            hash_set      => 'set',
            hash_is_empty => 'is_empty',
            hash_keys     => 'keys',
            hash_elements => 'elements',
            hash_kv       => 'kv',
            hash_defined  => 'defined',
            hash_accessor => 'accessor',
            hash_count    => 'count',
            hash_clear    => 'clear',
        },
    );

    has counter => (
        traits  => ['Counter'],
        isa     => 'Int',
        value   => 0,
        default => 0, # XXX: ugh, needed because of the default_default stuff
        handles => {
            counter_set   => 'set',
            counter_reset => 'reset',
            counter_inc   => 'inc',
            counter_dec   => 'dec',
        },
    );

    has code => (
        traits  => ['Code'],
        isa     => 'CodeRef',
        block   => sub { sub { } },
        handles => {
            code_execute        => 'execute',
            code_execute_method => 'execute_method',
        },
    );

    has array => (
        traits  => ['Array'],
        isa     => 'ArrayRef',
        block   => sub { [] },
        handles => {
            array_unshift       => 'unshift',
            array_shuffle       => 'shuffle',
            array_delete        => 'delete',
            array_get           => 'get',
            array_set           => 'set',
            array_uniq          => 'uniq',
            array_is_empty      => 'is_empty',
            array_shift         => 'shift',
            array_grep          => 'grep',
            array_sort_in_place => 'sort_in_place',
            array_sort          => 'sort',
            array_elements      => 'elements',
            array_pop           => 'pop',
            array_reduce        => 'reduce',
            array_insert        => 'insert',
            array_join          => 'join',
            array_first         => 'first',
            array_natatime      => 'natatime',
            array_accessor      => 'accessor',
            array_count         => 'count',
            array_map           => 'map',
            array_push          => 'push',
            array_clear         => 'clear',
            array_splice        => 'splice',
        },
    );

    has number => (
        traits  => ['Number'],
        isa     => 'Num',
        value   => 1,
        handles => {
            number_add => 'add',
            number_set => 'set',
            number_sub => 'sub',
            number_mul => 'mul',
            number_mod => 'mod',
            number_abs => 'abs',
            number_div => 'div',
        },
    );

    __PACKAGE__->meta->make_immutable;
}

pass("everything compiled successfully");

done_testing;