32-info.t (1914B)
1 #!/usr/bin/env perl 2 3 use strict; 4 use warnings; 5 6 use Test::More; 7 8 use FindBin '$RealBin'; 9 use lib "$RealBin/../SBO-Lib/lib"; 10 use SBO::Lib 'parse_info'; 11 12 plan tests => 23; 13 14 my %parse = parse_info(<<"END"); 15 FOO="bar" 16 BAR="foo bar 17 baz" 18 BAZ="barf foof 19 bazf" 20 QUUX="finf" 21 FLAR_f="trailing whitespace" 22 FLINGLE="\ 23 glorg \ 24 glorg \ 25 and\ 26 a\ 27 gloob\ 28 blorx\ 29 " 30 END 31 32 is ($parse{FOO}[0], 'bar', 'bar value gotten from FOO key'); 33 is ($parse{FOO}[1], undef, 'FOO key has correct length'); 34 is ($parse{BAR}[0], 'foo', 'foo value gotten from BAR key'); 35 is ($parse{BAR}[1], 'bar', 'bar value gotten from BAR key'); 36 is ($parse{BAR}[2], 'baz', 'baz value gotten from BAR key'); 37 is ($parse{BAR}[3], undef, 'BAR key has correct length'); 38 is ($parse{BAZ}[0], 'barf', 'barf value gotten from BAZ key'); 39 is ($parse{BAZ}[1], 'foof', 'foof value gotten from BAZ key'); 40 is ($parse{BAZ}[2], 'bazf', 'bazf value gotten from BAZ key'); 41 is ($parse{BAZ}[3], undef, 'BAZ key has correct length'); 42 is ($parse{QUUX}[0], 'finf', 'finf value gotten from QUUX key'); 43 is ($parse{QUUX}[1], undef, 'QUUX key has correct length'); 44 is ($parse{FLAR_f}[0], 'trailing', 'trailing value gotten from FLAR_f key'); 45 is ($parse{FLAR_f}[1], 'whitespace', 'whitespace value gotten from FLAR_f key'); 46 is ($parse{FLAR_f}[2], undef, 'FLAR_f key has correct length'); 47 is ($parse{FLINGLE}[0], 'glorg', 'glorg value gotten from FLINGLE key'); 48 is ($parse{FLINGLE}[1], 'glorg', 'glorg value gotten from FLINGLE key'); 49 is ($parse{FLINGLE}[2], 'and', 'and value gotten from FLINGLE key'); 50 is ($parse{FLINGLE}[3], 'a', 'a value gotten from FLINGLE key'); 51 is ($parse{FLINGLE}[4], 'gloob', 'gloob value gotten from FLINGLE key'); 52 is ($parse{FLINGLE}[5], 'blorx', 'blorx value gotten from FLINGLE key'); 53 is ($parse{FLINGLE}[6], undef, 'FLINGLE key has correct length'); 54 delete @parse{qw/ FOO BAR BAZ QUUX FLAR_f FLINGLE /}; 55 is (scalar %parse, 0, 'no additional keys were parsed');