Move is_valid_class_name into XS
[gitmo/Mouse.git] / t / 001_mouse / 051_throw_error.t
CommitLineData
bf8497ea 1#!/usr/bin/perl
2use strict;
3use warnings;
4use Test::More tests => 4;
5use Test::Exception;
6
7{
8 package Role;
9 use Mouse::Role;
10
11 sub rmethod{
12 $_[0]->meta->throw_error('bar');
13 }
14
15 package Class;
16 use Mouse;
17
18 with 'Role';
19
20 sub cmethod{
21 $_[0]->meta->throw_error('foo');
22 }
23}
24
25
26throws_ok {
27 Class->new->cmethod();
28} qr/\b foo \b/xms;
29
30throws_ok {
31 Class->cmethod();
32} qr/\b foo \b/xms;
33
34
35
36throws_ok {
37 Class->new->rmethod();
38} qr/\b bar \b/xms;
39
40throws_ok {
41 Class->rmethod();
42} qr/\b bar \b/xms;
43