2
0
mirror of https://github.com/bpkg/bpkg synced 2024-11-19 15:25:36 +00:00
bpkg/lib/json/test/parse-test.sh
Joseph Werle 16a53e5bcb init
2014-05-22 15:52:58 -04:00

36 lines
510 B
Bash
Executable File

#! /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