test_get_output_file 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env bash
  2. set -e
  3. set -u
  4. set -o pipefail
  5. source "${BASH_SOURCE%/*}/assertions.sh"
  6. test_get_output_file() {
  7. local file_type=${1:?}
  8. local path=${2:?}
  9. local output_dir=${3:-?}
  10. source "${BASH_SOURCE%/*}/../src/utils/functions.sh"
  11. get_output_file "$file_type" "$path" "$output_dir"
  12. }
  13. test_get_output_file_main() {
  14. # NOTE: Related to get_working_ext returns the filename when no
  15. # ext
  16. assert_equal \
  17. "test_get_output_file" \
  18. "output/foo/glux" \
  19. "$(test_get_output_file "markdown" "glux" "output/foo")"
  20. assert_equal \
  21. "test_get_output_file" \
  22. "output/foo/glux.html" \
  23. "$(test_get_output_file "org" "glux.org" "output/foo")"
  24. assert_equal \
  25. "test_get_output_file" \
  26. "output/foo/glux.html" \
  27. "$(test_get_output_file "markdown" "glux.md" "output/foo")"
  28. assert_equal \
  29. "test_get_output_file" \
  30. "output/foo/glux.txt" \
  31. "$(test_get_output_file "org" "glux.txt" "output/foo")"
  32. assert_equal \
  33. "test_get_output_file" \
  34. "output/foo/glux.txt" \
  35. "$(test_get_output_file "markdown" "glux.txt" "output/foo")"
  36. }
  37. test_get_output_file_main