7690ce282a2f8106ce77769243a8f844c2063c80
[gitmo/Moose.git] / t / test_moose / with_immutable.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::Builder::Tester;
7 use Test::More;
8
9 use Test::Moose;
10
11 {
12     package Foo;
13     use Moose;
14 }
15
16 {
17     package Bar;
18     use Moose;
19 }
20
21 package main;
22
23 test_out("ok 1", "not ok 2");
24 test_fail(+2);
25 my $ret = with_immutable {
26     ok(Foo->meta->is_mutable);
27 } qw(Foo);
28 test_test('with_immutable failure');
29 ok(!$ret, "one of our tests failed");
30
31 test_out("ok 1", "ok 2");
32 $ret = with_immutable {
33     ok(Bar->meta->find_method_by_name('new'));
34 } qw(Bar);
35 test_test('with_immutable success');
36 ok($ret, "all tests succeeded");
37
38 done_testing;