Fix a couple of INI whitespace bugs
* iniset() bails if no section or option (attribute) is supplied
* merge_config_file() properly skips lines with only whitespace
* Also split the ini-tests into their own script
Bug 1257954
Change-Id: Ie31c5bd0df8dfed129fbcf1e37228aaf25e9305d
diff --git a/tests/test_config.sh b/tests/test_config.sh
index fed2e7d..39603c9 100755
--- a/tests/test_config.sh
+++ b/tests/test_config.sh
@@ -70,6 +70,12 @@
[[test1|test1c.conf]]
$TEST_1C_ADD
+
+[[test3|test-space.conf]]
+[DEFAULT]
+attribute=value
+
+# the above line has a single space
EOF
@@ -176,4 +182,14 @@
echo "failed: $VAL != $EXPECT_VAL"
fi
-rm -f test.conf test1c.conf test2a.conf
+echo -n "merge_config_file test-space: "
+rm -f test-space.conf
+merge_config_file test.conf test3 test-space.conf
+VAL=$(cat test-space.conf)
+# iniset adds a blank line if it creates the file...
+EXPECT_VAL="
+[DEFAULT]
+attribute = value"
+check_result "$VAL" "$EXPECT_VAL"
+
+rm -f test.conf test1c.conf test2a.conf test-space.conf