#!/usr/bin/env bash SCRIPT_DIR="$(cd -- "$(dirname -- "$0")" && pwd)" cd "${SCRIPT_DIR}/tool" || return JQ=${JQ:-jq} export JQ_FLAVOR=${JQ_FLAVOR:-"$(basename "${JQ}")"} export JQ_TYPECHECKING=1 if [ ! -d "./lib/stubs/${JQ_FLAVOR}" ]; then STUBS_DIR="./lib/stubs/${JQ_FLAVOR}" else STUBS_DIR="./lib/stubs/jq" fi runTests() { echo "Running Tests with JQ=${JQ}" export JQ_FLAVOR=${JQ_FLAVOR:-"$(basename "${JQ}")"} ${JQ} -nr \ -L "$(realpath .)" -L "$(realpath ./lib)" -L "$(realpath "${STUBS_DIR}")" \ "include \"tests\"; testsMain" } runTests if command -v gojq 2>/dev/null >/dev/null; then JQ=gojq JQ_FLAVOR=gojq runTests fi