support ./orcli test

This commit is contained in:
felixlohmeier 2022-12-03 00:33:01 +00:00
parent 8b2e35ced2
commit 56c9bbe21e
3 changed files with 20 additions and 14 deletions

View File

@ -137,3 +137,9 @@ orcli uses [bashly](https://github.com/DannyBen/bashly/) for generating the one-
```sh ```sh
bashly generate --upgrade bashly generate --upgrade
``` ```
4. Run tests
```sh
./orcli test
```

14
orcli
View File

@ -1043,13 +1043,6 @@ orcli_test_command() {
# src/test_command.sh # src/test_command.sh
# shellcheck shell=bash disable=SC2154 # 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 # locate orcli and OpenRefine
scriptpath=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") scriptpath=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
if [[ -x "${scriptpath}/refine" ]]; then 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?" error "OpenRefine's startup script (refine) not found!" "Did you put orcli in your OpenRefine app dir?"
fi fi
# check existence of files
if ! [[ -f "tests/help.sh" ]]; then
error "Cannot open test files!"
fi
cd "tests"
files=(*.sh)
# create tmp directory # create tmp directory
OPENREFINE_TMPDIR="$(mktemp -d)" OPENREFINE_TMPDIR="$(mktemp -d)"
trap '{ rm -rf "$OPENREFINE_TMPDIR"; }' 0 2 3 15 trap '{ rm -rf "$OPENREFINE_TMPDIR"; }' 0 2 3 15

View File

@ -1,12 +1,5 @@
# shellcheck shell=bash disable=SC2154 # 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 # locate orcli and OpenRefine
scriptpath=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") scriptpath=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
if [[ -x "${scriptpath}/refine" ]]; then 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?" error "OpenRefine's startup script (refine) not found!" "Did you put orcli in your OpenRefine app dir?"
fi fi
# check existence of files
if ! [[ -f "tests/help.sh" ]]; then
error "Cannot open test files!"
fi
cd "tests"
files=(*.sh)
# create tmp directory # create tmp directory
OPENREFINE_TMPDIR="$(mktemp -d)" OPENREFINE_TMPDIR="$(mktemp -d)"
trap '{ rm -rf "$OPENREFINE_TMPDIR"; }' 0 2 3 15 trap '{ rm -rf "$OPENREFINE_TMPDIR"; }' 0 2 3 15