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

39 lines
683 B
Bash
Executable File

#!/bin/sh
validate="@CMAKE_CURRENT_BINARY_DIR@/json-validate"
basedir="@CMAKE_CURRENT_SOURCE_DIR@/test/json/validate"
count=0
code=0
for i in $(ls "${basedir}/good/"*);
do
$validate $i 2>/dev/null 1>&2
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
for i in $(ls "${basedir}/bad/"*);
do
$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"
exit $code