Move t/*/t into t/001_mouse
[gitmo/Mouse.git] / t / 001_mouse / 032-buildargs.t
diff --git a/t/001_mouse/032-buildargs.t b/t/001_mouse/032-buildargs.t
new file mode 100644 (file)
index 0000000..4b286f3
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+do {
+    package Foo;
+    use Mouse;
+
+    has foo => ( is => "rw" );
+
+    sub BUILDARGS {
+        my ( $self, @args ) = @_;
+        return { @args % 2 ? ( foo => @args ) : @args };
+    }
+};
+
+is(Foo->new->foo, undef, "no value");
+is(Foo->new("bar")->foo, "bar", "single arg");
+is(Foo->new(foo => "bar")->foo, "bar", "twoargs");
+