Fix iniset and his friends

* In python the white spaces are part of the section name
* Handle options with empty value
* Support paths with white spaces

Change-Id: I69a584608853cfdb8b7dce1e24d929216ef2fc41
diff --git a/tests/functions.sh b/tests/functions.sh
index be48729..4fe6443 100755
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -57,6 +57,9 @@
 
 [ ccc ]
 spaces  =  yes
+
+[ddd]
+empty =
 EOF
 
 # Test with spaces
@@ -79,13 +82,22 @@
 
 # Test with spaces in section header
 
-VAL=$(iniget test.ini ccc spaces)
+VAL=$(iniget test.ini " ccc " spaces)
 if [[ "$VAL" == "yes" ]]; then
     echo "OK: $VAL"
 else
     echo "iniget failed: $VAL"
 fi
 
+iniset test.ini "b b" opt_ion 42
+
+VAL=$(iniget test.ini "b b" opt_ion)
+if [[ "$VAL" == "42" ]]; then
+    echo "OK: $VAL"
+else
+    echo "iniget failed: $VAL"
+fi
+
 # Test without spaces, end of file
 
 VAL=$(iniget test.ini bbb handlers)
@@ -104,6 +116,29 @@
     echo "iniget failed: $VAL"
 fi
 
+# test empty option
+if ini_has_option test.ini ddd empty; then
+   echo "OK: ddd.empty present"
+else
+   echo "ini_has_option failed: ddd.empty not found"
+fi
+
+# test non-empty option
+if ini_has_option test.ini bbb handlers; then
+   echo "OK: bbb.handlers present"
+else
+   echo "ini_has_option failed: bbb.handlers not found"
+fi
+
+# test changing empty option
+iniset test.ini ddd empty "42"
+
+VAL=$(iniget test.ini ddd empty)
+if [[ "$VAL" == "42" ]]; then
+    echo "OK: $VAL"
+else
+    echo "iniget failed: $VAL"
+fi
 
 # Test section not exist
 
@@ -132,6 +167,12 @@
     echo "iniget failed: $VAL"
 fi
 
+if ! ini_has_option test.ini aaa debug; then
+    echo "OK aaa.debug not present"
+else
+    echo "ini_has_option failed: aaa.debug"
+fi
+
 iniset test.ini aaa debug "999"
 
 VAL=$(iniget test.ini aaa debug)