| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
# This script is a regression test for: |
| 4 |
# |
| 5 |
# https://rt.cpan.org/Ticket/Display.html?id=45588 |
| 6 |
# |
| 7 |
# Failure to read the ini file contents from a scalar |
| 8 |
|
| 9 |
use Test::More; |
| 10 |
|
| 11 |
use strict; |
| 12 |
use warnings; |
| 13 |
|
| 14 |
use Config::IniFiles; |
| 15 |
|
| 16 |
if ( !eval { require IO::Scalar; } ) |
| 17 |
{ |
| 18 |
plan skip_all => "IO::Scalar is not available"; |
| 19 |
} |
| 20 |
else |
| 21 |
{ |
| 22 |
plan tests => 2; |
| 23 |
} |
| 24 |
|
| 25 |
{ |
| 26 |
my $contents = <<'EOF'; |
| 27 |
[section1] |
| 28 |
key = val |
| 29 |
EOF |
| 30 |
|
| 31 |
my $conf = Config::IniFiles->new( -file => \$contents ); |
| 32 |
|
| 33 |
# TEST |
| 34 |
ok( $conf, "Object was initialised from reference to scalar." ); |
| 35 |
|
| 36 |
# TEST |
| 37 |
is( $conf->val( "section1", "key" ), "val", "Object works." ); |
| 38 |
} |
| 39 |
|