diff --git a/README.md b/README.md index c6178a6..34af565 100644 --- a/README.md +++ b/README.md @@ -137,3 +137,9 @@ orcli uses [bashly](https://github.com/DannyBen/bashly/) for generating the one- ```sh bashly generate --upgrade ``` + +4. Run tests + + ```sh + ./orcli test + ``` \ No newline at end of file diff --git a/orcli b/orcli index 9fda828..9a6b339 100755 --- a/orcli +++ b/orcli @@ -1043,13 +1043,6 @@ orcli_test_command() { # src/test_command.sh # shellcheck shell=bash disable=SC2154 - # check existence of files - if ! [[ -f "tests/help.sh" ]]; then - error "Cannot open test files!" - fi - cd "tests" - files=(*.sh) - # locate orcli and OpenRefine scriptpath=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") if [[ -x "${scriptpath}/refine" ]]; then @@ -1058,6 +1051,13 @@ orcli_test_command() { error "OpenRefine's startup script (refine) not found!" "Did you put orcli in your OpenRefine app dir?" fi + # check existence of files + if ! [[ -f "tests/help.sh" ]]; then + error "Cannot open test files!" + fi + cd "tests" + files=(*.sh) + # create tmp directory OPENREFINE_TMPDIR="$(mktemp -d)" trap '{ rm -rf "$OPENREFINE_TMPDIR"; }' 0 2 3 15 diff --git a/src/test_command.sh b/src/test_command.sh index 77a8b0e..65b9113 100644 --- a/src/test_command.sh +++ b/src/test_command.sh @@ -1,12 +1,5 @@ # shellcheck shell=bash disable=SC2154 -# check existence of files -if ! [[ -f "tests/help.sh" ]]; then - error "Cannot open test files!" -fi -cd "tests" -files=(*.sh) - # locate orcli and OpenRefine scriptpath=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") if [[ -x "${scriptpath}/refine" ]]; then @@ -15,6 +8,13 @@ else error "OpenRefine's startup script (refine) not found!" "Did you put orcli in your OpenRefine app dir?" fi +# check existence of files +if ! [[ -f "tests/help.sh" ]]; then + error "Cannot open test files!" +fi +cd "tests" +files=(*.sh) + # create tmp directory OPENREFINE_TMPDIR="$(mktemp -d)" trap '{ rm -rf "$OPENREFINE_TMPDIR"; }' 0 2 3 15