repo.or.cz
/
Method-Signatures-Simple.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
removed redundant stuff in xt/, which is now part of Devel::Declare
[Method-Signatures-Simple.git]
/
t
/
02-use.t
blob
354625487bde9a8fc10b81134af208f9baaff158
1
2
use strict;
3
use warnings;
4
5
use Test::More tests => 7;
6
use_ok 'Method::Signatures::Simple';
7
8
{
9
package My::Obj;
10
use Method::Signatures::Simple;
11
12
method make($class: %opts) {
13
bless {%opts}, $class;
14
}
15
method first : lvalue {
16
$self->{first};
17
}
18
method second {
19
$self->first + 1;
20
}
21
method nth($inc) {
22
$self->first + $inc;
23
}
24
}
25
26
my $o = My::Obj->make(first => 1);
27
is $o->first, 1;
28
is $o->second, 2;
29
is $o->nth(10), 11;
30
31
$o->first = 10;
32
33
is $o->first, 10;
34
is $o->second, 11;
35
is $o->nth(10), 20;
36