shell dot on steroids https://pagure.io/shellfu

iniread 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. . /usr/share/beakerlib/beakerlib.sh
  3. . <(ffoom init)
  4. ffoo import ini
  5. enum_tests() {
  6. echo "both_keys_and_sections"
  7. echo "games_with_spaces"
  8. echo "keys_only"
  9. echo "keys_sections_spaces"
  10. echo "merge"
  11. echo "merge_strict"
  12. echo "path"
  13. echo "plain"
  14. echo "plain_strict"
  15. echo "sections_only"
  16. echo "tricks_with_strange_naming"
  17. echo "strict_and_space"
  18. echo "strict_and_tab"
  19. # echo "list_keys" # not implemented
  20. # echo "list_paths" # not implemented
  21. # echo "list_sections" # not implemented
  22. }
  23. do_test() {
  24. local name=$1
  25. local head=$(cat "$name" | head -1 | sed -e 's/\s*#\s*/#/g')
  26. local desc=$(cut -d\# -f 2 <<<"$head")
  27. local args=$(cut -d\# -f 3 <<<"$head")
  28. local env=$(cat $name.env 2>/dev/null)
  29. rlPhaseStartTest "$desc"
  30. rlRun "$env iniread $args - < $name > $name.result"
  31. rlRun "diff -u $name.oracle $name.result"
  32. rlPhaseEnd
  33. }
  34. rlJournalStart
  35. rlPhaseStartSetup
  36. tmp=$(mktemp -d)
  37. cp -r $(dirname $0)/data/ini/iniread/* $tmp
  38. pushd $tmp
  39. rlPhaseEnd
  40. for name in $(enum_tests);
  41. do
  42. do_test $name
  43. done
  44. rlPhaseStartCleanup
  45. popd
  46. rm -rf $tmp
  47. rlPhaseEnd
  48. rlJournalEnd