diff --git a/test/0-init-fail.sh b/test/0-init-fail.sh new file mode 100755 index 0000000..11fadf4 --- /dev/null +++ b/test/0-init-fail.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +packname="0-init-fail-pack" +deps="logger PACKAGE_DONT_EXIST" # would be very unlucky if it does exist... + +$DUB init $packname $deps + +function cleanup { + rm -rf $packname +} + +if [ -e $packname/dub.json ]; then # package is there, it should have failed + cleanup + exit 1 +fi +exit 0 diff --git a/test/0-init-fail/.gitignore b/test/0-init-fail/.gitignore deleted file mode 100644 index 433d266..0000000 --- a/test/0-init-fail/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.dub -docs.json -__dummy.html -*.o -*.obj diff --git a/test/0-init-fail/0-init-fail.sh b/test/0-init-fail/0-init-fail.sh deleted file mode 100755 index 11fadf4..0000000 --- a/test/0-init-fail/0-init-fail.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -packname="0-init-fail-pack" -deps="logger PACKAGE_DONT_EXIST" # would be very unlucky if it does exist... - -$DUB init $packname $deps - -function cleanup { - rm -rf $packname -} - -if [ -e $packname/dub.json ]; then # package is there, it should have failed - cleanup - exit 1 -fi -exit 0 diff --git a/test/0-init-fail/dub.json b/test/0-init-fail/dub.json deleted file mode 100644 index 6e6605b..0000000 --- a/test/0-init-fail/dub.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "0-init-fail", - "description": "A minimal D application.", - "copyright": "Copyright © 2014, colin", - "authors": ["colin"], - "dependencies": { - } -} diff --git a/test/0-init-fail/source/app.d b/test/0-init-fail/source/app.d deleted file mode 100644 index 0569360..0000000 --- a/test/0-init-fail/source/app.d +++ /dev/null @@ -1,10 +0,0 @@ -import std.stdio; - -import std.process : execute; -int main(string[] args) -{ - writefln("Executing init test - fail"); - auto script = args[0] ~ ".sh"; - auto dubInit = execute(script); - return dubInit.status; -} diff --git a/test/0-init-multi.sh b/test/0-init-multi.sh new file mode 100755 index 0000000..54b151e --- /dev/null +++ b/test/0-init-multi.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +packname="0-init-multi-pack" +deps="openssl logger" +type="vibe.d" + +$DUB init $packname $deps --type=$type + +function cleanup { + rm -rf $packname +} + +if [ ! -e $packname/dub.json ]; then # it failed, exit 1 + exit 1 +else # check if resulting dub.json has all dependancies in tow + deps="$deps vibe-d"; + IFS=" " read -a arr <<< "$deps" + for ele in "${arr[@]}" + do + if [ `grep -c "$ele" $packname/dub.json` -ne 1 ]; then #something went wrong + echo "$ele not in $packname/dub.json" + cleanup + exit 1 + fi + done + cleanup + exit 0 + +fi diff --git a/test/0-init-multi/.gitignore b/test/0-init-multi/.gitignore deleted file mode 100644 index 433d266..0000000 --- a/test/0-init-multi/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.dub -docs.json -__dummy.html -*.o -*.obj diff --git a/test/0-init-multi/0-init-multi.sh b/test/0-init-multi/0-init-multi.sh deleted file mode 100755 index 54b151e..0000000 --- a/test/0-init-multi/0-init-multi.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -packname="0-init-multi-pack" -deps="openssl logger" -type="vibe.d" - -$DUB init $packname $deps --type=$type - -function cleanup { - rm -rf $packname -} - -if [ ! -e $packname/dub.json ]; then # it failed, exit 1 - exit 1 -else # check if resulting dub.json has all dependancies in tow - deps="$deps vibe-d"; - IFS=" " read -a arr <<< "$deps" - for ele in "${arr[@]}" - do - if [ `grep -c "$ele" $packname/dub.json` -ne 1 ]; then #something went wrong - echo "$ele not in $packname/dub.json" - cleanup - exit 1 - fi - done - cleanup - exit 0 - -fi diff --git a/test/0-init-multi/dub.json b/test/0-init-multi/dub.json deleted file mode 100644 index 752ff18..0000000 --- a/test/0-init-multi/dub.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "0-init-multi", - "description": "A minimal D application.", - "copyright": "Copyright © 2014, colin", - "authors": ["colin"], - "dependencies": { - } -} diff --git a/test/0-init-multi/source/app.d b/test/0-init-multi/source/app.d deleted file mode 100644 index acd9893..0000000 --- a/test/0-init-multi/source/app.d +++ /dev/null @@ -1,10 +0,0 @@ -import std.stdio; - -import std.process : execute; -int main(string[] args) -{ - writefln("Executing init test - multi"); - auto script = args[0] ~ ".sh"; - auto dubInit = execute(script); - return dubInit.status; -} diff --git a/test/0-init-simple.sh b/test/0-init-simple.sh new file mode 100755 index 0000000..b5f9227 --- /dev/null +++ b/test/0-init-simple.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +packname="0-init-simple-pack" + +$DUB init $packname + +function cleanup { + rm -rf $packname +} + +if [ ! -e $packname/dub.json ]; then # it failed + cleanup + exit 1 +fi +cleanup +exit 0 diff --git a/test/0-init-simple/.gitignore b/test/0-init-simple/.gitignore deleted file mode 100644 index 433d266..0000000 --- a/test/0-init-simple/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.dub -docs.json -__dummy.html -*.o -*.obj diff --git a/test/0-init-simple/0-init-simple.sh b/test/0-init-simple/0-init-simple.sh deleted file mode 100755 index b5f9227..0000000 --- a/test/0-init-simple/0-init-simple.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -packname="0-init-simple-pack" - -$DUB init $packname - -function cleanup { - rm -rf $packname -} - -if [ ! -e $packname/dub.json ]; then # it failed - cleanup - exit 1 -fi -cleanup -exit 0 diff --git a/test/0-init-simple/dub.json b/test/0-init-simple/dub.json deleted file mode 100644 index 276804f..0000000 --- a/test/0-init-simple/dub.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "0-init-simple", - "description": "A minimal D application.", - "copyright": "Copyright © 2014, colin", - "authors": ["colin"], - "dependencies": { - } -} diff --git a/test/0-init-simple/source/app.d b/test/0-init-simple/source/app.d deleted file mode 100644 index 2bd9e78..0000000 --- a/test/0-init-simple/source/app.d +++ /dev/null @@ -1,10 +0,0 @@ -import std.stdio; - -import std.process : execute; -int main(string[] args) -{ - writefln("Executing init test - simple"); - auto script = args[0] ~ ".sh"; - auto dubInit = execute(script); - return dubInit.status; -} diff --git a/test/run-unittest.sh b/test/run-unittest.sh index a308ef4..ad0a219 100755 --- a/test/run-unittest.sh +++ b/test/run-unittest.sh @@ -23,7 +23,7 @@ for script in $(ls $CURR_DIR/*.sh); do if [ "$script" = "$(readlink -f ${BASH_SOURCE[0]})" ]; then continue; fi log "Running $script..." - $script || die "Script failure." + DUB=$DUB COMPILER=$COMPILER $script || die "Script failure." done for pack in $(ls -d $CURR_DIR/*/); do