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