Newer
Older
dub_jkp / test / issue877-auto-fetch-package-on-run.sh
@Martin Nowak Martin Nowak on 28 Apr 2019 1 KB add non-interactive mode to build command
  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) 2>&1 | grep "Failed to find.*gitcompatibledubpackage.*locally"
  23.  
  24. # check supplying versions directly
  25. dub_log="$($DUB run gitcompatibledubpackage@1.0.3)"
  26. echo "$dub_log" | grep "Hello DUB"
  27. echo "$dub_log" | grep "Fetching.*1.0.3"
  28. $DUB remove gitcompatibledubpackage
  29.  
  30. # check supplying an invalid version
  31. (! $DUB run gitcompatibledubpackage@0.42.43) 2>&1 | \
  32. grep 'No package gitcompatibledubpackage was found matching the dependency 0[.]42[.]43'
  33.  
  34. ! $DUB remove gitcompatibledubpackage