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