File: 05__default.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 (25 lines) | stat: -rw-r--r-- 398 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
#!/usr/bin/perl

##
## Tests for accessors.pm
##

use strict;
use warnings;

use Test::More tests => 6;
use Carp;

BEGIN { use_ok( "accessors" ) };

## use default style:
my $foo = bless {}, 'Foo';
can_ok( $foo, 'bar' );
can_ok( $foo, 'baz' );

ok( $foo->bar( 1 ), 'set default' );
is( $foo->bar, 1 ,  'get default' );
ok( !$foo->baz,     'get default');

package Foo;
use accessors qw( bar baz );