Newer
Older
dub_jkp / test / issue877-auto-fetch-package-on-run.sh
  1. #!/bin/bash
  2.  
  3. set -eu -o pipefail
  4. set -x
  5. $DUB remove --version="*" gitcompatibledubpackage || true
  6.  
  7. # check whether the interactive run mode works
  8. echo "y" | $DUB run gitcompatibledubpackage | grep "Hello DUB"
  9. $DUB remove gitcompatibledubpackage
  10.  
  11. ! (echo "n" | $DUB run gitcompatibledubpackage | grep "Hello DUB")
  12. ! $DUB remove gitcompatibledubpackage
  13.  
  14. # check -y
  15. $DUB run --yes gitcompatibledubpackage | grep "Hello DUB"
  16. $DUB remove gitcompatibledubpackage
  17.  
  18. # check --yes
  19. $DUB run -y gitcompatibledubpackage | grep "Hello DUB"
  20. $DUB remove gitcompatibledubpackage
  21.  
  22. (! $DUB run --non-interactive gitcompatibledubpackage || true) 2>&1 | \
  23. grep "Failed to find.*gitcompatibledubpackage.*locally"
  24.  
  25. # check supplying versions directly
  26. dub_log="$($DUB run gitcompatibledubpackage@1.0.3)"
  27. echo "$dub_log" | grep "Hello DUB"
  28. echo "$dub_log" | grep "Fetching.*1.0.3"
  29. $DUB remove gitcompatibledubpackage
  30.  
  31. # check supplying an invalid version
  32. (! $DUB run gitcompatibledubpackage@0.42.43 || true) 2>&1 | \
  33. grep 'No package gitcompatibledubpackage was found matching the dependency 0[.]42[.]43'
  34.  
  35. ! $DUB remove gitcompatibledubpackage