summaryrefslogtreecommitdiff
path: root/t/004-load-double.t
blob: 40204bd96a43df5d4d14a401c0b2e18f98967b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
use warnings;

use Test::More 0.88;
use lib 't/lib';
use Test::Class::Load ':all';
use Test::Fatal;

# This test does 2 things.
# Firstly, confirm that on 5.8, load_class will
# still throw an exception , even if its been loaded before:
#
#    eval { require Foo; }; require Foo; # doesn't error on 5.8
#
# Secondly, to ensure errors thrown are useful.
# ( As without the code in load_class to delete $INC{file}
#    it will just die with "COMPILATION ERROR", which is
#    not useful )
#
like( exception {
    load_class('Class::Load::SyntaxError');
}, qr/syntax error/ );

like( exception {
    load_class('Class::Load::SyntaxError');
}, qr/syntax error/ );

done_testing;