1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/usr/bin/perl
##
## Tests for accessors::rw
##
use strict;
use warnings;
use Test::More tests => 6;
use Carp;
BEGIN { use_ok( "accessors::rw" ) };
my $time = shift || 0.5;
my $foo = bless {}, 'Foo';
can_ok( $foo, 'bar' );
can_ok( $foo, 'baz' );
is( $foo->bar( 'set' ), 'set', 'set foo->bar' );
is( $foo->baz( 2 ), 2, 'set foo->baz' );
is( $foo->bar, 'set', 'get foo->bar' );
# no sense benchmarking this as it inherits from accessors::classic.
package Foo;
use accessors::rw qw( bar baz );
|