File: 06__rw.t

package info (click to toggle)
libaccessors-perl 1.01-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 164 kB
  • sloc: perl: 330; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 518 bytes parent folder | download | duplicates (4)
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 );