#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More tests => 9;
use Mouse::Util ':test';
do {
is(Class->new->code->(), 1, "default => sub sub strips off the first coderef");
is_deeply(Class->new->a, [1], "default of sub { reference } works");
+do {
+ package Class::Two;
+ use Mouse;
+ has foo => (is => 'rw', default => sub { shift->default_foo });
+ sub default_foo { 1 };
+};
+
+my $obj2 = Class::Two->new;
+is($obj2->foo, 1, 'default method gets the $_[0] it needs to work');