Commit | Line | Data |
---|---|---|
d574882a | 1 | #!/usr/bin/env perl |
2 | use strict; | |
3 | use warnings; | |
4 | use Test::More tests => 3; | |
5 | ||
3652e8c0 | 6 | do { |
d574882a | 7 | package Foo; |
8 | use Mouse; | |
9 | ||
10 | has foo => ( is => "rw" ); | |
11 | ||
12 | sub BUILDARGS { | |
13 | my ( $self, @args ) = @_; | |
14 | return { @args % 2 ? ( foo => @args ) : @args }; | |
15 | } | |
3652e8c0 | 16 | }; |
d574882a | 17 | |
3652e8c0 | 18 | is(Foo->new->foo, undef, "no value"); |
19 | is(Foo->new("bar")->foo, "bar", "single arg"); | |
20 | is(Foo->new(foo => "bar")->foo, "bar", "twoargs"); | |
d574882a | 21 |