fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
604 B

  1. #!/bin/bash
  2. exname=$(basename $0)
  3. prefix_cmd="
  4. . /etc/shlib
  5. include common
  6. include parse
  7. . ../lib/common
  8. "
  9. # mock
  10. cfg-get-value() {
  11. local key="$1"
  12. shyaml get-value "$key" 2>/dev/null
  13. }
  14. export -f cfg-get-value
  15. yaml_get_interpret() {
  16. shyaml get-value
  17. }
  18. export -f yaml_get_interpret
  19. ##
  20. ## Tests
  21. ##
  22. try "
  23. _get_custom_rules '
  24. '"
  25. noerror
  26. is out ''
  27. try "
  28. _get_custom_rules '
  29. apache-custom-rules:
  30. '"
  31. noerror
  32. is out ''
  33. try "
  34. _get_custom_rules '
  35. apache-custom-rules:
  36. - a
  37. - b
  38. '"
  39. noerror
  40. is out 'a
  41. b'
  42. try "
  43. _get_custom_rules '
  44. apache-custom-rules:
  45. a: x
  46. b: y
  47. '"
  48. noerror
  49. is out '
  50. x
  51. y'