Newer
Older
dub_jkp / test / 4-describe-import-paths.sh
@Martin Nowak Martin Nowak on 3 Jul 2017 868 bytes unify flags and error handling
  1. #!/usr/bin/env bash
  2.  
  3. . $(dirname "${BASH_SOURCE[0]}")/common.sh
  4.  
  5. cd "$CURR_DIR"/describe-project
  6.  
  7. temp_file=$(mktemp $(basename $0).XXXXXX)
  8.  
  9. function cleanup {
  10. rm $temp_file
  11. }
  12.  
  13. trap cleanup EXIT
  14.  
  15. if ! $DUB describe --compiler=$DC --import-paths > "$temp_file"; then
  16. die 'Printing import paths failed!'
  17. fi
  18.  
  19. # Create the expected output path file to compare against.
  20. echo "$CURR_DIR/describe-project/src/" > "$CURR_DIR/expected-import-path-output"
  21. echo "$CURR_DIR/describe-dependency-1/source/" >> "$CURR_DIR/expected-import-path-output"
  22. echo "$CURR_DIR/describe-dependency-2/some-path/" >> "$CURR_DIR/expected-import-path-output"
  23. echo "$CURR_DIR/describe-dependency-3/dep3-source/" >> "$CURR_DIR/expected-import-path-output"
  24.  
  25. if ! diff "$CURR_DIR"/expected-import-path-output "$temp_file"; then
  26. die 'The import paths did not match the expected output!'
  27. fi
  28.