Revert autogenerated tests. Tests should not changed radically.
[gitmo/Mouse.git] / t / 020_attributes / failing / 023_attribute_names.t
CommitLineData
4060c871 1#!/usr/bin/perl
2
3use strict;
4use warnings;
9864f0e4 5use Test::More tests => 8;
4060c871 6use Test::Exception;
7
8my $exception_regex = qr/You must provide a name for the attribute/;
9{
10 package My::Role;
11 use Mouse::Role;
12
13 ::throws_ok {
14 has;
15 } $exception_regex, 'has; fails';
16
17 ::throws_ok {
18 has undef;
19 } $exception_regex, 'has undef; fails';
20
21 ::lives_ok {
22 has "" => (
23 is => 'bare',
24 );
25 } 'has ""; works now';
26
27 ::lives_ok {
28 has 0 => (
29 is => 'bare',
30 );
31 } 'has 0; works now';
32}
33
34{
35 package My::Class;
36 use Mouse;
37
38 ::throws_ok {
39 has;
40 } $exception_regex, 'has; fails';
41
42 ::throws_ok {
43 has undef;
44 } $exception_regex, 'has undef; fails';
45
46 ::lives_ok {
47 has "" => (
48 is => 'bare',
49 );
50 } 'has ""; works now';
51
52 ::lives_ok {
53 has 0 => (
54 is => 'bare',
55 );
56 } 'has 0; works now';
57}
58