Newer
Older
dub_jkp / test / issue616-describe-vs-generate-commands.sh
@Martin Nowak Martin Nowak on 26 Sep 2015 970 bytes mktemp on OSX requires a template
  1. #!/bin/bash
  2. set -e -o pipefail
  3.  
  4. cd "$CURR_DIR"/issue616-describe-vs-generate-commands
  5.  
  6. temp_file=$(mktemp $(basename $0).XXXXXX)
  7.  
  8. function cleanup {
  9. rm $temp_file
  10. }
  11.  
  12. trap cleanup EXIT
  13.  
  14. if ! $DUB describe --compiler=$COMPILER --data-list --data=target-name \
  15. > "$temp_file" 2>&1; then
  16. die 'Printing project data failed!'
  17. fi
  18.  
  19. # Create the expected output file to compare stdout against.
  20. expected_file="$CURR_DIR/expected-issue616-output"
  21. echo "preGenerateCommands: DUB_PACKAGES_USED=issue616-describe-vs-generate-commands,issue616-subpack,issue616-subsubpack" > "$expected_file"
  22. echo "$CURR_DIR/issue616-describe-vs-generate-commands/src/" >> "$expected_file"
  23. echo "$CURR_DIR/issue616-subpack/src/" >> "$expected_file"
  24. echo "$CURR_DIR/issue616-subsubpack/src/" >> "$expected_file"
  25. echo "issue616-describe-vs-generate-commands" >> "$expected_file"
  26.  
  27. if ! diff "$expected_file" "$temp_file"; then
  28. die 'The stdout output did not match the expected output!'
  29. fi