060_batch 884 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. test_batch_set()
  2. {
  3. touch ${CONFIG_DIR}/batch_set
  4. ${UCI} batch <<EOF
  5. set batch_set.SEC0='section'
  6. set batch_set.SEC0.option0='value0'
  7. set batch_set.SEC0.option1='"Hello,
  8. '" World\""
  9. set batch_set.SEC1='section'
  10. set batch_set.SEC1.option0="value1"
  11. EOF
  12. ${UCI} commit
  13. assertSameFile "${REF_DIR}/batch_set.result" "${CONFIG_DIR}/batch_set"
  14. }
  15. test_batch_comments()
  16. {
  17. touch ${CONFIG_DIR}/batch_comments
  18. ${UCI} batch <<EOF
  19. # first line comment
  20. set batch_comments.SEC0='section'
  21. set batch_comments.SEC0.option0='value0'
  22. # two consecutive blank lines
  23. # two consecutive blank lines
  24. set batch_comments.SEC0.option1='"Hello,
  25. '" World\""
  26. set batch_comments.SEC1='section'
  27. set batch_comments.SEC1.option0="value1"
  28. # comment line starts with spaces.
  29. commit
  30. # last line comment
  31. EOF
  32. assertSameFile "${REF_DIR}/batch_comments.result" "${CONFIG_DIR}/batch_comments"
  33. }