#!/bin/sh cd $(0%/*) # Can't detect sourcing in sh, so immediately terminate the attempt to parse source ../JSON.sh /dev/null } setglobal fails = '0' setglobal i = '0' echo "1..4" for input in ['"oooo" ' '[true, 1, [0, {}]] ' '{"true": 1}]' { setglobal i = $shExpr('i+1') if echo $input | ptest { echo "ok $i - $input" } else { echo "not ok $i - $input" setglobal fails = $shExpr('fails+1') } } if ! ptest < ../package.json { echo "not ok 4 - Parsing package.json failed!" setglobal fails = $shExpr('fails+1') } else { echo "ok $i - package.json" } echo "$fails test(s) failed" exit $fails