3 export LUA_PATH="../?.lua;;"
4 export LUA_CPATH="../?.so;;"
8 if ! which "$RUNWITH"; then
9 echo "Unable to find interpreter $RUNWITH";
13 if ! $RUNWITH -e 'assert(require"util.json")' 2>/dev/null; then
14 echo "Unable to find util.json";
20 for f in json/pass*.json; do
21 if ! $RUNWITH -e 'local j=require"util.json" assert(j.decode(io.read("*a"))~=nil)' <"$f" 2>/dev/null; then
22 echo "Failed to decode valid JSON: $f";
27 for f in json/fail*.json; do
28 if ! $RUNWITH -e 'local j=require"util.json" assert(j.decode(io.read("*a"))==nil)' <"$f" 2>/dev/null; then
29 echo "Invalid JSON decoded without error: $f";
34 if [ "$FAIL" == "1" ]; then
35 echo "JSON tests failed"