Revert autogenerated tests. Tests should not changed radically.
[gitmo/Mouse.git] / t / 300_immutable / 008_immutable_constructor_error.t
CommitLineData
fc1d8369 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
9864f0e4 6use Test::More tests => 2;
fc1d8369 7use Test::Exception;
8
9
9864f0e4 10
fc1d8369 11=pod
12
13This tests to make sure that we provide the same error messages from
14an immutable constructor as is provided by a non-immutable
15constructor.
16
17=cut
18
19{
20 package Foo;
b0000b3d 21 use Mouse;
fc1d8369 22
23 has 'foo' => (is => 'rw', isa => 'Int');
24
25 Foo->meta->make_immutable(debug => 0);
26}
27
28my $scalar = 1;
29throws_ok { Foo->new($scalar) } qr/\QSingle parameters to new() must be a HASH ref/,
30 'Non-ref provided to immutable constructor gives useful error message';
31throws_ok { Foo->new(\$scalar) } qr/\QSingle parameters to new() must be a HASH ref/,
32 'Scalar ref provided to immutable constructor gives useful error message';
33