Format Changes
[gitmo/Mouse.git] / t / 001_mouse / 032-buildargs.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use Test::More tests => 3;
5
6 do {
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     }
16 };
17
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");
21