refactored out fast method modifier as Class::Method::Modifiers::Fast and used Class...
[gitmo/Mouse.git] / t / 032-buildargs.t
CommitLineData
d574882a 1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More tests => 3;
5
3652e8c0 6do {
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 18is(Foo->new->foo, undef, "no value");
19is(Foo->new("bar")->foo, "bar", "single arg");
20is(Foo->new(foo => "bar")->foo, "bar", "twoargs");
d574882a 21