Newer
Older
dub_jkp / test / 5-convert.sh
@Martin Nowak Martin Nowak on 4 Jul 2017 689 bytes replace all usages of `exit`
  1. #!/usr/bin/env bash
  2.  
  3. . $(dirname "${BASH_SOURCE[0]}")/common.sh
  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. trap cleanup EXIT
  13.  
  14. cp dub.sdl dub.sdl.ref
  15.  
  16. $DUB convert -f json
  17.  
  18. if [ -f "dub.sdl" ]; then die $LINENO 'Old recipe file not removed.'; fi
  19. if [ ! -f "dub.json" ]; then die $LINENO 'New recipe file not created.'; fi
  20.  
  21. $DUB convert -f sdl
  22.  
  23. if [ -f "dub.json" ]; then die $LINENO 'Old recipe file not removed.'; fi
  24. if [ ! -f "dub.sdl" ]; then die $LINENO 'New recipe file not created.'; fi
  25.  
  26. if ! diff "dub.sdl" "dub.sdl.ref"; then
  27. die $LINENO 'The project data did not match the expected output!'
  28. fi
  29.  
  30. rm dub.sdl.ref
  31.