File: parse_string.t

package info (click to toggle)
libconfigreader-simple-perl 1.29-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 220 kB
  • ctags: 27
  • sloc: perl: 657; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/perl
use strict;
use warnings;

use Test::More 'no_plan';

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
my $class  = 'ConfigReader::Simple';
my $method = 'parse_string';

use_ok( $class );
can_ok( $class, $method );

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
{
my $string = <<"HERE";
cat Buster
dog \\
	Tuffy
bird Poppy
# comment = hello
kitty \\
	Mimi
HERE

my $config = $class->new();

$config->parse_string( \$string );

is( $config->get( "cat" ),    "Buster"  );
is( $config->get( "kitty" ),  "Mimi"    );
is( $config->get( "dog" ),    "Tuffy"   );
is( $config->get( "bird" ),    "Poppy"  );
is( $config->get( "comment" ), undef    );
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#