070_revert 961 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. revert_test_prepare() {
  2. touch ${CONFIG_DIR}/revert
  3. ${UCI} set revert.SEC0=section
  4. ${UCI} set revert.SEC0.option0=value0
  5. ${UCI} set revert.SEC0.option1='"Hello,
  6. '" World\""
  7. }
  8. test_revert_section()
  9. {
  10. revert_test_prepare
  11. ${UCI} revert revert.SEC0
  12. assertSameFile "${REF_DIR}/revert_section.result" "$CHANGES_DIR/revert"
  13. }
  14. test_revert_option()
  15. {
  16. revert_test_prepare
  17. ${UCI} revert revert.SEC0.option0
  18. assertSameFile "${REF_DIR}/revert_option.result" "$CHANGES_DIR/revert"
  19. }
  20. test_revert_option_multiline()
  21. {
  22. revert_test_prepare
  23. ${UCI} revert revert.SEC0.option1
  24. assertSameFile "${REF_DIR}/revert_option_multiline.result" "$CHANGES_DIR/revert"
  25. }
  26. test_revert_option_long()
  27. {
  28. local val="$(head -c 8192 < /dev/zero | tr '\0' 'a')"
  29. local res
  30. touch ${CONFIG_DIR}/p
  31. ${UCI} set p.s=sec
  32. ${UCI} set p.s.o="$val"
  33. res="$(${UCI} changes)"
  34. assertEquals "p.s='sec'
  35. p.s.o='$val'" "$res"
  36. ${UCI} revert p
  37. res="$(${UCI} changes)"
  38. assertEquals "" "$res"
  39. }