| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | |
| 6 | use Test::More tests => 3; |
| 7 | |
| 8 | use Config::IniFiles; |
| 9 | |
| 10 | use lib "./t/lib"; |
| 11 | |
| 12 | use Config::IniFiles::TestPaths; |
| 13 | |
| 14 | my $ini = Config::IniFiles->new( |
| 15 | -file => t_file('php-compat.ini'), |
| 16 | -php_compat => 1 |
| 17 | ) or die($!); |
| 18 | |
| 19 | # Test 1 |
| 20 | # strings enclosed with " are processed as double quoted string |
| 21 | |
| 22 | # TEST |
| 23 | is_deeply( |
| 24 | [ scalar( $ini->val( "group1", "val1" ) ) ], |
| 25 | [q{str"ing}], "value with double-quotes in php_compat", |
| 26 | ); |
| 27 | |
| 28 | # Test 2 |
| 29 | # strings enclosed with ' are processed as single quoted string |
| 30 | |
| 31 | # TEST |
| 32 | is_deeply( |
| 33 | [ $ini->val( "group1", "val2" ) ], |
| 34 | [q{string}], "value with single-quotes in php_compat", |
| 35 | ); |
| 36 | |
| 37 | # Test 3 |
| 38 | # ignore [] in val-Names |
| 39 | |
| 40 | # TEST |
| 41 | is_deeply( |
| 42 | [ $ini->val( "group2", "val1" ) ], |
| 43 | [ 1, 2 ], |
| 44 | "value with php array key in php_compat", |
| 45 | ); |