Newer
Older
dub_jkp / test / 5-convert.sh
@Sönke Ludwig Sönke Ludwig on 12 Jan 2016 669 bytes Add newline.
  1. #!/bin/bash
  2.  
  3. set -e -o pipefail
  4.  
  5. cd "$CURR_DIR"/5-convert
  6.  
  7. temp_file=$(mktemp $(basename $0).XXXXXX)
  8.  
  9. function cleanup {
  10. rm $temp_file
  11. }
  12.  
  13. function die {
  14. echo "$@" 1>&2
  15. exit 1
  16. }
  17.  
  18. trap cleanup EXIT
  19.  
  20. cp dub.sdl dub.sdl.ref
  21.  
  22. $DUB convert -f json
  23.  
  24. if [ -f "dub.sdl" ]; then die 'Old recipe file not removed.'; fi
  25. if [ ! -f "dub.json" ]; then die 'New recipe file not created.'; fi
  26.  
  27. $DUB convert -f sdl
  28.  
  29. if [ -f "dub.json" ]; then die 'Old recipe file not removed.'; fi
  30. if [ ! -f "dub.sdl" ]; then die 'New recipe file not created.'; fi
  31.  
  32. if ! diff "dub.sdl" "dub.sdl.ref"; then
  33. die 'The project data did not match the expected output!'
  34. fi
  35.  
  36. rm dub.sdl.ref
  37.  
  38. echo OK
  39.