Commit | Line | Data |
c3398f5b |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | use Test::More tests => 3; |
5 | |
6 | my %trigger; |
7 | do { |
8 | package Class; |
9 | use Mouse; |
10 | |
9ca3f175 |
11 | for my $attr (qw/a b c/) { |
12 | has $attr => ( |
13 | is => 'rw', |
14 | trigger => sub { |
15 | $trigger{$attr}++; |
16 | }, |
17 | ); |
18 | } |
c3398f5b |
19 | }; |
20 | |
21 | can_ok(Class => qw/a b c/); |
f89acace |
22 | is(keys %{ Class->meta->get_attribute_map }, 3, "three attributes created"); |
c3398f5b |
23 | Class->new(a => 1, b => 2); |
24 | |
25 | is_deeply(\%trigger, { a => 1, b => 1 }, "correct triggers called"); |
26 | |