File: new_object_BUILD.t

package info (click to toggle)
libmoose-perl 2.2207-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 7,416 kB
  • sloc: perl: 21,345; ansic: 291; makefile: 10
file content (23 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;
use warnings;
use Test::More;

my $called;
{
    package Foo;
    use Moose;

    sub BUILD { $called++ }
}

Foo->new;
is($called, 1, "BUILD called from ->new");
$called = 0;
Foo->meta->new_object;
is($called, 1, "BUILD called from ->meta->new_object");
Foo->new({__no_BUILD__ => 1});
is($called, 1, "BUILD not called from ->new with __no_BUILD__");
Foo->meta->new_object({__no_BUILD__ => 1});
is($called, 1, "BUILD not called from ->meta->new_object with __no_BUILD__");

done_testing;