Class-Load-XS

 view release on metacpan or  search on metacpan

t/004-load-double.t  view on Meta::CPAN

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;



( run in 1.501 second using v1.01-cache-2.11-cpan-54e63673c56 )