File: optional_positional.t

package info (click to toggle)
libmoosex-declare-perl 0.43-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 564 kB
  • ctags: 82
  • sloc: perl: 1,240; makefile: 9
file content (30 lines) | stat: -rw-r--r-- 532 bytes parent folder | download | duplicates (3)
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
use strict;
use warnings;

use Test::More tests => 3;
use Test::Fatal;

use MooseX::Declare;

class ValueHolder {
    has value => (
        is => 'rw',
        isa => 'Any',
    );

    around value ($newval?) {
        $orig->($newval);
    }

    method method1 ($argument?) {
        +@_;
    }
}

is( exception {
    ValueHolder->new(value => 22)->value;
}, undef, 'value() should not die');

is( exception {
    is(ValueHolder->new->method1, 1, 'method1() should only get 1 element in @_');
}, undef, 'nor should method1()');