fix incompatibilities with TB2
[gitmo/Moose.git] / t / test_moose / with_immutable.t
CommitLineData
f2ca7ada 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
a28e50e4 6use Test::Builder::Tester;
f2ca7ada 7use Test::More;
8
9153f80b 9plan skip_all => 'These tests are only for Test::Builder 0.9x'
10 if Test::Builder->VERSION >= 1.005;
11
28fdde7f 12use Test::Moose;
f2ca7ada 13
14{
15 package Foo;
16 use Moose;
17}
18
92c04d5e 19{
20 package Bar;
21 use Moose;
22}
23
f2ca7ada 24package main;
25
26test_out("ok 1", "not ok 2");
27test_fail(+2);
92c04d5e 28my $ret = with_immutable {
f2ca7ada 29 ok(Foo->meta->is_mutable);
30} qw(Foo);
92c04d5e 31test_test('with_immutable failure');
32ok(!$ret, "one of our tests failed");
f2ca7ada 33
92c04d5e 34test_out("ok 1", "ok 2");
35$ret = with_immutable {
36 ok(Bar->meta->find_method_by_name('new'));
37} qw(Bar);
38test_test('with_immutable success');
39ok($ret, "all tests succeeded");
a28e50e4 40
41done_testing;