1#!/usr/bin/env perl 2 3use strict; 4use warnings; 5 6use File::Spec; 7use FindBin qw($Bin); 8use Test::More tests => 4; 9 10use lib (File::Spec->catdir($Bin, 'lib')); 11 12subtest Good => sub { 13 # pre-exception sanity-check 14 eval 'use Good'; 15 is $@, '', 'use: Good using true'; 16 is Good::Good(), 'Good', 'use: Good loaded OK'; 17}; 18 19subtest DirectCompileTimeException => sub { 20 local $TODO = "don't clean after itself yet"; 21 eval 'use DirectCompileTimeException'; 22 # make sure the entry was cleared from %true::TRUE 23 like $@, qr{\bDirectCompileTimeException\b}, 'direct: module throws a compile-time exception'; 24 is_deeply \%true::TRUE, {}, 'direct: true cleans up correctly'; 25}; 26 27subtest IndirectCompileTimeException => sub { 28 local $TODO = "don't clean after itself yet"; 29 eval 'use IndirectCompileTimeException'; 30 # make sure the entry was cleared from %true::TRUE 31 like $@, qr{\bIndirectCompileTimeException\b}, 'indirect: module throws a compile-time exception'; 32 is_deeply \%true::TRUE, {}, 'direct: true cleans up correctly'; 33}; 34 35# post-exception sanity-check 36subtest Ugly => sub { 37 eval 'use Ugly'; 38 is $@, '', 'use: Ugly using true'; 39 is Ugly::Ugly(), 'Ugly', 'use: Ugly loaded OK'; 40}; 41