Newer
Older
dub_jkp / test / issue1040-run-with-ver.sh
  1. #!/usr/bin/env bash
  2.  
  3. . $(dirname "${BASH_SOURCE[0]}")/common.sh
  4.  
  5. if ! [ -d ${CURR_DIR}/issue1040-tmpdir ]; then
  6. mkdir ${CURR_DIR}/issue1040-tmpdir
  7. touch ${CURR_DIR}/issue1040-tmpdir/.no_build
  8. touch ${CURR_DIR}/issue1040-tmpdir/.no_run
  9. touch ${CURR_DIR}/issue1040-tmpdir/.no_test
  10. function cleanup {
  11. rm -rf ${CURR_DIR}/issue1040-tmpdir
  12. }
  13. trap cleanup EXIT
  14. fi
  15.  
  16. cd ${CURR_DIR}/issue1040-tmpdir
  17.  
  18. $DUB fetch dub@1.17.0 --cache=local
  19. $DUB fetch dub@1.18.0 --cache=local
  20. $DUB fetch dub@1.19.0 --cache=local
  21.  
  22. if { $DUB fetch dub@1.18.0 --cache=local || true; } | grep -cF 'Fetching' > /dev/null; then
  23. die $LINENO 'Test for doubly fetch of the specified version has failed.'
  24. fi
  25. if ! { $DUB run dub -q --cache=local -- --version || true; } | grep -cF 'DUB version 1.19.0' > /dev/null; then
  26. die $LINENO 'Test for selection of the latest fetched version has failed.'
  27. fi
  28. if ! { $DUB run dub@1.18.0 -q --cache=local -- --version || true; } | grep -cF 'DUB version 1.18.0' > /dev/null; then
  29. die $LINENO 'Test for selection of the specified version has failed.'
  30. fi