libcruft-util/test/json-parse.sh.in

38 lines
679 B
Bash
Raw Normal View History

#!/bin/sh
2018-07-05 13:43:28 +10:00
validate="@CMAKE_CURRENT_BINARY_DIR@/json-validate"
count=0
code=0
2018-07-05 13:43:28 +10:00
for i in $(ls "@CMAKE_CURRENT_SOURCE_DIR@/test/json/good/"*);
do
2018-07-05 13:43:28 +10:00
$validate $i 2>/dev/null 1>&2
2018-07-05 13:43:28 +10:00
if [ $? -eq 0 ]; then
echo "ok - good/$(basename $i .json)"
else
echo "not ok - good/$(basename $i .json)"
code=1
fi
count=$((count+1))
done
2018-07-05 13:43:28 +10:00
for i in $(ls "@CMAKE_CURRENT_SOURCE_DIR@/test/json/bad/"*);
do
2018-07-05 13:43:28 +10:00
$validate $i 1>&2 2>/dev/null
if [ $? -eq 0 ]; then
echo "not ok - bad/$(basename $i .json)"
code=1
else
echo "ok - bad/$(basename $i .json)"
fi
count=$((count+1))
done
echo "1..$count"
2018-07-05 13:43:28 +10:00
exit $code