12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. . "$TF_DIR/include/subtest.sh"
  3. . "$TF_DIR/include/tools.sh"
  4. . "$(sfpath)" || tf_exit_error "failed to init shellfu"
  5. shellfu import inigrep || tf_exit_error "failed to import inigrep"
  6. tf_enum_subtests() {
  7. echo "both_keys_and_sections"
  8. echo "games_with_spaces"
  9. echo "keys_only"
  10. echo "keys_sections_spaces"
  11. # echo "plain" # FIXME: arguable
  12. # echo "plain_strict" # FIXME: arguable
  13. echo "sections_only"
  14. echo "tricks_with_strange_naming"
  15. echo "strict_and_space"
  16. echo "strict_and_tab"
  17. echo "inlinecmt_hash"
  18. echo "inlinecmt_sc"
  19. echo "inlinecmt_hash_and_strict"
  20. echo "inlinecmt_sc_and_strict"
  21. echo "list_keys"
  22. echo "list_paths"
  23. echo "list_sections"
  24. echo "list_tricky_all_keys"
  25. echo "list_tricky_all_paths"
  26. echo "list_tricky_all_sections"
  27. echo "list_tricky_s1_keys"
  28. }
  29. tf_do_subtest() {
  30. local name=$1
  31. local t_in="test/$name.stdin"
  32. local o_out="oracle/$name.stdout"
  33. case $name in
  34. inlinecmt_*) t_in="test/inlinecmt.stdin" ;;
  35. esac
  36. local cmd
  37. case $name in
  38. both_keys_and_sections) cmd='inigrep section1.key1' ;;
  39. games_with_spaces) cmd='inigrep "maybe spaced.spaced key"' ;;
  40. keys_only) cmd='inigrep .key1' ;;
  41. keys_sections_spaces) cmd='inigrep section1.key1' ;;
  42. plain) cmd='inigrep .' ;;
  43. plain_strict) cmd='inigrep -r .' ;;
  44. sections_only) cmd='inigrep section2.' ;;
  45. tricks_with_strange_naming) cmd='inigrep "section with/ slash and spaces".' ;;
  46. strict_and_space) cmd='inigrep -r myscript.py' ;;
  47. strict_and_tab) cmd='inigrep -r my_script.py' ;;
  48. inlinecmt_hash) cmd='inigrep joe.score' ;;
  49. inlinecmt_sc) cmd='inigrep bob.score' ;;
  50. inlinecmt_hash_and_strict) cmd='inigrep -r joe.catchphrase' ;;
  51. inlinecmt_sc_and_strict) cmd='inigrep -r bob.catchphrase' ;;
  52. list_keys) cmd='inigrep -K ""' ;;
  53. list_paths) cmd='inigrep -P' ;;
  54. list_sections) cmd='inigrep -S' ;;
  55. list_tricky_all_keys) cmd='inigrep -K ""' ;;
  56. list_tricky_all_paths) cmd='inigrep -P' ;;
  57. list_tricky_all_sections) cmd='inigrep -S' ;;
  58. list_tricky_s1_keys) cmd='inigrep -K s1' ;;
  59. esac
  60. tf_testflt -n "$name" -i "$t_in" -O "$o_out" "$cmd"
  61. }
  62. tf_do_subtests