File: 001-basic.t

package info (click to toggle)
libany-moose-perl 0.24-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 320 kB
  • ctags: 13
  • sloc: perl: 837; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 472 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;

do {
    package Point;
    use Any::Moose;

    has ['x', 'y'] => (
        is  => 'rw',
        isa => 'Int',
    );

    sub BUILDARGS {
        my ($class, $x, $y) = @_;
        return { x => $x, y => $y };
    }
};

my $origin = Point->new(0, 0);
is($origin->x, 0);
is($origin->y, 0);

my $aa = Point->new(1, 1);
is($aa->x, 1);
is($aa->y, 1);

$aa->x(-1);

is($aa->x, -1);
is($aa->y, 1);

done_testing;