From 570eea7d91a8c3ef4abf02b0b51d01ff16df213e Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 11 Mar 2010 13:42:15 -0800 Subject: [PATCH] Add test for passing through traits. --- t/Definition.t | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/t/Definition.t b/t/Definition.t index 2da54b569..0a339eb10 100644 --- a/t/Definition.t +++ b/t/Definition.t @@ -16,7 +16,8 @@ use lib "$FindBin::Bin/lib"; use WebGUI::Test; -use Test::More tests => 16; +use Test::More; +#use Test::More tests => 17; use Test::Deep; use Test::Exception; @@ -174,3 +175,28 @@ my $session = WebGUI::Test->session; '... checking inherited class' ); } + +{ + package WGT::Class5; + use Moose; + use WebGUI::Definition; + + property 'traitorous' => ( + noFormPost => 1, + traits => ['Array'], + isa => 'ArrayRef', + is => 'ro', + handles => { + pop_traitor => 'pop', + push_traitor => 'push', + }, + default => sub { [] }, + ); + + my $object5 = WGT::Class5->new({session => $session}); + $object5->push_traitor('Boggs'); + ::cmp_deeply($object5->traitorous, ['Boggs'], 'push_traitor handler worked'); + +} + +done_testing();