Skip to content

Commit cede787

Browse files
committed
Add file creation test
Ensure that iniadd is creating files that don't exist, as it has historically done. Change-Id: I2798996f3d46ff1dce410b815a87395f1bf729f9
1 parent f44a024 commit cede787

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

inc/ini-config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ function inidelete {
159159

160160
# Set an option in an INI file
161161
# iniset [-sudo] config-file section option value
162+
# - if the file does not exist, it is created
162163
function iniset {
163164
local xtrace=$(set +o | grep xtrace)
164165
set +o xtrace

tests/test_ini_config.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ for x in $del_cases; do
199199
fi
200200
done
201201

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+
202207
$SUDO rm -rf ${INI_TMP_DIR}
203208

204209
report_results

0 commit comments

Comments
 (0)