| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
# This script attempts to reproduce: |
| 4 |
# https://github.com/shlomif/perl-Config-IniFiles/issues/6 |
| 5 |
|
| 6 |
use strict; |
| 7 |
use warnings; |
| 8 |
|
| 9 |
use Test::More tests => 3; |
| 10 |
use File::Spec; |
| 11 |
|
| 12 |
use Config::IniFiles; |
| 13 |
|
| 14 |
use lib './t/lib'; |
| 15 |
use Config::IniFiles::TestPaths; |
| 16 |
|
| 17 |
{ |
| 18 |
local $@ = ''; |
| 19 |
my $ERRORS = ''; |
| 20 |
local $SIG{__WARN__} = sub { $ERRORS .= $_[0] }; |
| 21 |
|
| 22 |
my $ini; |
| 23 |
eval { |
| 24 |
$ini = Config::IniFiles->new( |
| 25 |
-file => t_file('here-doc-no-end-marker.ini') ); |
| 26 |
}; |
| 27 |
|
| 28 |
# TEST |
| 29 |
ok( !$@ && !$ERRORS && !defined($ini), |
| 30 |
'A file with no heredoc end marker should fail, but not throw errors' ); |
| 31 |
|
| 32 |
# TEST |
| 33 |
is( scalar(@Config::IniFiles::errors), 1, 'There is one error.' ); |
| 34 |
|
| 35 |
# TEST |
| 36 |
like( |
| 37 |
$Config::IniFiles::errors[0], |
| 38 |
qr/no end marker \("NOEND"\) found/, |
| 39 |
q/Error was correct - 'no end marker ("NOEND") found'/, |
| 40 |
); |
| 41 |
} |