projects
/
gitmo/Moose.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
If you pass coerce => 1 for an attr, its type must have a coercion or an error is...
[gitmo/Moose.git]
/
t
/
020_attributes
/
034_bad_coerce.t
1
#!/usr/bin/perl
2
3
use strict;
4
use warnings;
5
6
use Test::More;
7
use Test::Exception;
8
9
{
10
package Foo;
11
12
use Moose;
13
14
::throws_ok{ has foo => (
15
is => 'ro',
16
isa => 'Str',
17
coerce => 1,
18
);
19
} qr/\QYou cannot coerce an attribute (foo) unless its type has a coercion/,
20
'Cannot coerce unless the type has a coercion';
21
}
22
23
done_testing;