From 56c9bbe21e6013f76f5f4058477af1240044a7d3 Mon Sep 17 00:00:00 2001 From: felixlohmeier Date: Sat, 3 Dec 2022 00:33:01 +0000 Subject: [PATCH] support ./orcli test --- README.md | 6 ++++++ orcli | 14 +++++++------- src/test_command.sh | 14 +++++++------- 3 files changed, 20 insertions(+), 14 deletions(-) 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