#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 11;
+use Test::Exception;
+
+{
+ package C;
+ use Mouse;
+}
+
+# original BUILDARGS
+
+is_deeply( C->BUILDARGS(), {} );
+is_deeply( C->BUILDARGS(foo => 42), {foo => 42} );
+is_deeply( C->BUILDARGS(foo => 42, foo => 'bar'), {foo => 'bar'} );
+is_deeply( C->BUILDARGS({foo => 1, bar => 2}), {foo => 1, bar => 2} );
+
+my %hash = (foo => 10);
+my $args = C->BUILDARGS(\%hash);
+$args->{foo}++;
+is $hash{foo}, 10, 'values must be copied';
+
+%hash = (foo => 10);
+$args = C->BUILDARGS(%hash);
+$args->{foo}++;
+is $hash{foo}, 10, 'values must be copied';
+
+throws_ok {
+ C->BUILDARGS([]);
+} qr/must be a HASH ref/;
+
+
+throws_ok {
+ C->BUILDARGS([]);
+} qr/must be a HASH ref/;
+
+
+# custom BUILDARGS
do {
package Foo;