diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-12-06 10:56:03 +0200 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-12-06 10:56:03 +0200 |
commit | 7e682e2b7d137f2f75a1f8b6aca3354516a75c3e (patch) | |
tree | 6f007fb09b3cd7b4283c1f8310496fbb9f76a350 | |
parent | 702615ed036e25b419b70539588eae8b2c1eeb72 (diff) | |
download | sbotools2-7e682e2b7d137f2f75a1f8b6aca3354516a75c3e.tar.xz |
t/32-info.t: add tests for parsing .info files
-rw-r--r-- | t/32-info.t | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/t/32-info.t b/t/32-info.t new file mode 100644 index 0000000..91cec79 --- /dev/null +++ b/t/32-info.t @@ -0,0 +1,34 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use Test::More; + +use SBO::Lib 'parse_info'; + +plan tests => 13; + +my %parse = parse_info(<<"END"); +FOO="bar" +BAR="foo bar +baz" +BAZ="barf foof + bazf" +QUUX="finf" +END + +is ($parse{FOO}[0], 'bar', 'bar value gotten from FOO key'); +is ($parse{FOO}[1], undef, 'FOO key has correct length'); +is ($parse{BAR}[0], 'foo', 'foo value gotten from BAR key'); +is ($parse{BAR}[1], 'bar', 'bar value gotten from BAR key'); +is ($parse{BAR}[2], 'baz', 'baz value gotten from BAR key'); +is ($parse{BAR}[3], undef, 'BAR key has correct length'); +is ($parse{BAZ}[0], 'barf', 'barf value gotten from BAZ key'); +is ($parse{BAZ}[1], 'foof', 'foof value gotten from BAZ key'); +is ($parse{BAZ}[2], 'bazf', 'bazf value gotten from BAZ key'); +is ($parse{BAZ}[3], undef, 'BAZ key has correct length'); +is ($parse{QUUX}[0], 'finf', 'finf value gotten from QUUX key'); +is ($parse{QUUX}[1], undef, 'QUUX key has correct length'); +delete @parse{qw/ FOO BAR BAZ QUUX /}; +is (scalar %parse, 0, 'no additional keys were parsed'); |