1 test_add_delta() { 2 local new_savedir="$TMP_DIR/new_savedir" 3 local config_delta="$CONFIG_DIR/delta" 4 local cmdoutput 5 6 # add normal changes 7 touch "$config_delta" 8 $UCI set delta.sec0=sectype 9 $UCI add_list delta.sec0.li0=0 10 11 # save new changes in "$new_savedir" 12 mkdir -p "$new_savedir" 13 touch "$new_savedir/delta" 14 $UCI -P "$new_savedir" set delta.sec0=tmptype 15 $UCI -P "$new_savedir" add_list delta.sec0.li0=1 16 $UCI -P "$new_savedir" set delta.sec0=sectype 17 18 assertEquals "delta.sec0='sectype' 19 delta.sec0.li0+='0'" "$($UCI changes)" 20 21 # check combined changes. Order matters here. 22 cmdoutput="$($UCI -P "$new_savedir" changes)" 23 assertTrue "$?" 24 assertEquals "delta.sec0='sectype' 25 delta.sec0.li0+='0' 26 delta.sec0='tmptype' 27 delta.sec0.li0+='1' 28 delta.sec0='sectype'" "$cmdoutput" 29 30 # check combined export. Order matters here. 31 cmdoutput="$($UCI -P "$new_savedir" export)" 32 assertTrue "$?" 33 assertEquals "$(cat $REF_DIR/cli.options.delta.export.result)" "$cmdoutput" 34 35 # check CLI_FLAG_NOCOMMIT with -P option. 36 $UCI -P "$new_savedir" commit 37 assertTrue "$?" 38 assertEquals "" "$(cat $config_delta)" 39 40 # check normal commit. 41 $UCI -p "$new_savedir" commit 42 assertTrue "$?" 43 assertSameFile "$REF_DIR/cli.options.delta.commit.result" "$config_delta" 44 45 rm -rf "$new_savedir" 46 rm -f "$config_delta" 47 } 48
This page was automatically generated by LXR 0.3.1. • OpenWrt