You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bpkg/lib/json/test/parse-test.sh

36 lines
510 B
Bash

#! /usr/bin/env bash
cd ${0%/*}
. ../JSON.sh
ptest () {
tokenize | parse >/dev/null
}
fails=0
i=0
echo "1..4"
for input in '"oooo" ' '[true, 1, [0, {}]] ' '{"true": 1}'
do
i=$((i+1))
if echo "$input" | ptest
then
echo "ok $i - $input"
else
echo "not ok $i - $input"
fails=$((fails+1))
fi
done
if ! ptest < ../package.json
then
echo "not ok 4 - Parsing package.json failed!"
fails=$((fails+1))
else
echo "ok $i - package.json"
fi
echo "$fails test(s) failed"
exit $fails