File: 01basics.t

package info (click to toggle)
libmu-tiny-perl 0.000002-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 104 kB
  • sloc: perl: 76; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 429 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
use strict;
use warnings;
use Test::More qw(no_plan);

BEGIN {
  package Foo;

  use Mu::Tiny;

  ro 'foo';
  ro 'bar';
  lazy baz => sub { 4 };

}

my $ok = eval { Foo->new; 1 };

my $err= $@;

ok !$ok, 'new() failed';

ok +($err =~ /foo/ and $err =~ /bar/), 'both missing required attrs reported';

my $obj = Foo->new(foo => 1, bar => 2);

is $obj->foo, 1, 'constructor population';
is $obj->baz, 4, 'lazy builder population';