Make sure that with "A", "B" throws an error
[gitmo/Mouse.git] / t / 032-buildargs.t
CommitLineData
d574882a 1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More tests => 3;
5
6use 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
20is( Foo->new->foo, undef, "no value" );
21is( Foo->new("bar")->foo, "bar", "single arg" );
22is( Foo->new(foo => "bar")->foo, "bar", "twoargs" );
23