diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-06-15 01:36:37 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-06-15 01:36:37 -0500 |
commit | 60c5f48aff6a579ce22bd4b4245f7be346609901 (patch) | |
tree | 7025b94a0470cef60d9c3694d0dbf247f5b30aaa /t/03-attrs.t | |
parent | 571bfa3b91ff5567338948776b6fce84d3ede09e (diff) | |
download | moosex-nonmoose-60c5f48aff6a579ce22bd4b4245f7be346609901.tar.gz moosex-nonmoose-60c5f48aff6a579ce22bd4b4245f7be346609901.zip |
convert to new dzil stuff
Diffstat (limited to 't/03-attrs.t')
-rw-r--r-- | t/03-attrs.t | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/t/03-attrs.t b/t/03-attrs.t new file mode 100644 index 0000000..6b25849 --- /dev/null +++ b/t/03-attrs.t @@ -0,0 +1,36 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 4; + +package Foo; + +sub new { + my $class = shift; + bless { @_ }, $class; +} + +sub foo { + my $self = shift; + return $self->{foo} unless @_; + $self->{foo} = shift; +} + +package Foo::Moose; +use Moose; +use MooseX::NonMoose; +extends 'Foo'; + +has bar => ( + is => 'rw', +); + +package main; + +my $foo_moose = Foo::Moose->new(foo => 'FOO', bar => 'BAR'); +is($foo_moose->foo, 'FOO', 'foo set in constructor'); +is($foo_moose->bar, 'BAR', 'bar set in constructor'); +$foo_moose->foo('BAZ'); +$foo_moose->bar('QUUX'); +is($foo_moose->foo, 'BAZ', 'foo set by accessor'); +is($foo_moose->bar, 'QUUX', 'bar set by accessor'); |