2
0

020_get 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. test_get_parsing()
  2. {
  3. cp ${REF_DIR}/get_parsing.data ${CONFIG_DIR}/test
  4. assertFailWithNoReturn "${UCI_Q} get test."
  5. assertFailWithNoReturn "${UCI_Q} get test.section."
  6. assertFailWithNoReturn "${UCI_Q} get test.section.opt."
  7. assertFailWithNoReturn "${UCI_Q} get test.section.opt.val."
  8. assertFailWithNoReturn "${UCI_Q} get test.section.opt.val.qsdf.qsd"
  9. assertFailWithNoReturn "${UCI_Q} get test.section.opt.valqsqsd"
  10. }
  11. test_get_section_index_parsing()
  12. {
  13. cp ${REF_DIR}/get_parsing.data ${CONFIG_DIR}/test
  14. assertFailWithNoReturn "${UCI_Q} get test.@"
  15. assertFailWithNoReturn "${UCI_Q} get test.@zer."
  16. assertFailWithNoReturn "${UCI_Q} get test.@."
  17. assertFailWithNoReturn "${UCI_Q} get test.@zer[1]"
  18. assertFailWithNoReturn "${UCI_Q} get test.@.opt"
  19. assertFailWithNoReturn "${UCI_Q} get test.@[28]"
  20. assertFailWithNoReturn "${UCI_Q} get test.@[1]."
  21. assertFailWithNoReturn "${UCI_Q} get test.@[1].val."
  22. }
  23. test_get_option()
  24. {
  25. cp ${REF_DIR}/get.data ${CONFIG_DIR}/test
  26. value=$($UCI get test.section.opt)
  27. assertEquals 'val' "$value"
  28. }
  29. test_get_option_multiline()
  30. {
  31. cp ${REF_DIR}/get_multiline.data ${CONFIG_DIR}/test
  32. value="$($UCI get test.section.opt)"
  33. assertEquals '"Hello, World.
  34. '\''' "$value"
  35. }
  36. test_get_section()
  37. {
  38. cp ${REF_DIR}/get.data ${CONFIG_DIR}/test
  39. type=$($UCI get test.section)
  40. assertEquals 'type' "$type"
  41. }