From: Yousong Zhou Date: Wed, 1 Apr 2015 12:44:22 +0000 (+0800) Subject: tests: add test coverage for uci export with -P option. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c24ff81c286698bf0cb4b80ba522b3ab7ee85de9;p=project%2Fuci.git tests: add test coverage for uci export with -P option. - With "uci -P xxx/ export", changes in "xxx/" should be applied last. - With "uci -p xxx/ commit", changes in "xxx/" should be applied before ctx->savedir. Signed-off-by: Yousong Zhou --- diff --git a/test/references/cli.options.delta.commit.result b/test/references/cli.options.delta.commit.result new file mode 100644 index 0000000..3119b6f --- /dev/null +++ b/test/references/cli.options.delta.commit.result @@ -0,0 +1,5 @@ + +config sectype 'sec0' + list li0 '1' + list li0 '0' + diff --git a/test/references/cli.options.delta.export.result b/test/references/cli.options.delta.export.result new file mode 100644 index 0000000..5aa71ce --- /dev/null +++ b/test/references/cli.options.delta.export.result @@ -0,0 +1,5 @@ +package delta + +config sectype 'sec0' + list li0 '0' + list li0 '1' diff --git a/test/references/options.delta.result b/test/references/options.delta.result deleted file mode 100644 index 3119b6f..0000000 --- a/test/references/options.delta.result +++ /dev/null @@ -1,5 +0,0 @@ - -config sectype 'sec0' - list li0 '1' - list li0 '0' - diff --git a/test/tests.d/090_cli_options b/test/tests.d/090_cli_options index 52052a3..55920a2 100644 --- a/test/tests.d/090_cli_options +++ b/test/tests.d/090_cli_options @@ -1,6 +1,7 @@ test_add_delta() { local new_savedir="$TMP_DIR/new_savedir" local config_delta="$CONFIG_DIR/delta" + local cmdoutput # add normal changes touch "$config_delta" @@ -16,11 +17,18 @@ test_add_delta() { assertEquals "delta.sec0='sectype' delta.sec0.li0+='0'" "$($UCI changes)" - # check combined changes. order matters here. + # check combined changes. Order matters here. + cmdoutput="$($UCI -P "$new_savedir" changes)" + assertTrue "$?" assertEquals "delta.sec0='sectype' -delta.sec0.li0+='1' +delta.sec0.li0+='0' delta.sec0='sectype' -delta.sec0.li0+='0'" "$($UCI -P "$new_savedir" changes)" +delta.sec0.li0+='1'" "$cmdoutput" + + # check combined export. Order matters here. + cmdoutput="$($UCI -P "$new_savedir" export)" + assertTrue "$?" + assertEquals "$(cat $REF_DIR/cli.options.delta.export.result)" "$cmdoutput" # check CLI_FLAG_NOCOMMIT with -P option. $UCI -P "$new_savedir" commit @@ -30,7 +38,7 @@ delta.sec0.li0+='0'" "$($UCI -P "$new_savedir" changes)" # check normal commit. $UCI -p "$new_savedir" commit assertTrue "$?" - assertSameFile "$REF_DIR/options.delta.result" "$config_delta" + assertSameFile "$REF_DIR/cli.options.delta.commit.result" "$config_delta" rm -rf "$new_savedir" rm -f "$config_delta"