Browse code

Add file creation test

Ensure that iniadd is creating files that don't exist, as it has
historically done.

Change-Id: I2798996f3d46ff1dce410b815a87395f1bf729f9

Ian Wienand authored on 2015/07/22 12:36:12
Showing 2 changed files
... ...
@@ -159,6 +159,7 @@ function inidelete {
159 159
 
160 160
 # Set an option in an INI file
161 161
 # iniset [-sudo] config-file section option value
162
+#  - if the file does not exist, it is created
162 163
 function iniset {
163 164
     local xtrace=$(set +o | grep xtrace)
164 165
     set +o xtrace
... ...
@@ -199,6 +199,11 @@ for x in $del_cases; do
199 199
     fi
200 200
 done
201 201
 
202
+# test file-creation
203
+iniset $SUDO_ARG ${INI_TMP_ETC_DIR}/test.new.ini test foo bar
204
+VAL=$(iniget ${INI_TMP_ETC_DIR}/test.new.ini test foo)
205
+assert_equal "$VAL" "bar" "iniset created file"
206
+
202 207
 $SUDO rm -rf ${INI_TMP_DIR}
203 208
 
204 209
 report_results