removed redundant stuff in xt/, which is now part of Devel::Declare
[Method-Signatures-Simple.git] / t / 02-use.t
blob354625487bde9a8fc10b81134af208f9baaff158
2 use strict;
3 use warnings;
5 use Test::More tests => 7;
6 use_ok 'Method::Signatures::Simple';
9     package My::Obj;
10     use Method::Signatures::Simple;
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     }
26 my $o = My::Obj->make(first => 1);
27 is $o->first, 1;
28 is $o->second, 2;
29 is $o->nth(10), 11;
31 $o->first = 10;
33 is $o->first, 10;
34 is $o->second, 11;
35 is $o->nth(10), 20;