Commit | Line | Data |
c3398f5b |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
262801ef |
4 | use Test::More tests => 11; |
eab81545 |
5 | use Test::Exception; |
c3398f5b |
6 | |
7 | require Mouse; |
8 | use lib 't/lib'; |
9 | |
9694b71b |
10 | ok(!Mouse::is_class_loaded(), "is_class_loaded with no argument returns false"); |
11 | ok(!Mouse::is_class_loaded(''), "can't load the empty class"); |
12 | ok(!Mouse::is_class_loaded(\"foo"), "can't load a class name reference??"); |
13 | |
14 | throws_ok { Mouse::load_class() } qr/Invalid class name \(undef\)/; |
15 | throws_ok { Mouse::load_class('') } qr/Invalid class name \(\)/; |
16 | throws_ok { Mouse::load_class(\"foo") } qr/Invalid class name \(SCALAR\(\w+\)\)/; |
262801ef |
17 | |
abe28e11 |
18 | ok(Mouse::load_class('Unsweetened')); |
19 | can_ok('Unsweetened' => 'unsweetened'); |
c3398f5b |
20 | |
21 | do { |
22 | package Class; |
2a674d23 |
23 | sub yay {} |
c3398f5b |
24 | }; |
25 | |
26 | ok(Mouse::load_class('Class'), "this should not die!"); |
27 | |
2a674d23 |
28 | throws_ok { |
29 | Mouse::load_class('FakeClassOhNo'); |
30 | } qr/Can't locate /; |
c3398f5b |
31 | |
32 | throws_ok { |
abe28e11 |
33 | Mouse::load_class('SyntaxError'); |
c3398f5b |
34 | } qr/Missing right curly/; |
35 | |