Newer
Older
dub_jkp / test / issue877-auto-fetch-package-on-run.sh
@Sebastian Wilzbach Sebastian Wilzbach on 16 Feb 2019 987 bytes dub run <package> should search the registry on failure
  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. # check supplying versions directly
  23. dub_log="$($DUB run gitcompatibledubpackage@1.0.3)"
  24. echo "$dub_log" | grep "Hello DUB"
  25. echo "$dub_log" | grep "Fetching.*1.0.3"
  26. $DUB remove gitcompatibledubpackage
  27.  
  28. # check supplying an invalid version
  29. (! $DUB run gitcompatibledubpackage@0.42.43) 2>&1 | \
  30. grep 'No package gitcompatibledubpackage was found matching the dependency 0[.]42[.]43'
  31.  
  32. ! $DUB remove gitcompatibledubpackage