aboutsummaryrefslogtreecommitdiff
path: root/t/32-info.t
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2017-01-17 10:56:43 +0100
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2017-01-17 10:56:43 +0100
commitd9e245af966d87164bc0322bf1fc498e1d891b08 (patch)
treea7a43f76d6407d9493ec5dc2252365945a7cc06c /t/32-info.t
parent33720829aca03ba0abd3756ac447d25f71cc27e1 (diff)
downloadsbotools2-d9e245af966d87164bc0322bf1fc498e1d891b08.tar.xz
Fix parsing of .info files with trailing whitespace. This fixes #54.
Diffstat (limited to 't/32-info.t')
-rw-r--r--t/32-info.t8
1 files changed, 6 insertions, 2 deletions
diff --git a/t/32-info.t b/t/32-info.t
index be39db1..8b74e4b 100644
--- a/t/32-info.t
+++ b/t/32-info.t
@@ -9,7 +9,7 @@ use FindBin '$RealBin';
use lib "$RealBin/../SBO-Lib/lib";
use SBO::Lib 'parse_info';
-plan tests => 13;
+plan tests => 16;
my %parse = parse_info(<<"END");
FOO="bar"
@@ -18,6 +18,7 @@ baz"
BAZ="barf foof
bazf"
QUUX="finf"
+FLAR_f="trailing whitespace"
END
is ($parse{FOO}[0], 'bar', 'bar value gotten from FOO key');
@@ -32,5 +33,8 @@ 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 ($parse{FLAR_f}[0], 'trailing', 'trailing value gotten from FLAR_f key');
+is ($parse{FLAR_f}[1], 'whitespace', 'whitespace value gotten from FLAR_f key');
+is ($parse{FLAR_f}[2], undef, 'FLAR_f key has correct length');
+delete @parse{qw/ FOO BAR BAZ QUUX FLAR_f /};
is (scalar %parse, 0, 'no additional keys were parsed');