json: rearrange schema test to allow for modified output

Schemas can insert default values, so we need to be able to test the
resultant files.
This commit is contained in:
Danny Robson 2018-07-05 15:02:14 +10:00
parent 30c35b2101
commit 94640d00f0
48 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1 @@
[1,"a", {}]

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@
"ab"

View File

@ -0,0 +1 @@
"abcdef"

25
test/json/schema/test.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
tool="/home/danny/src/lobo/build/debug/gcc/cruft/util/json-schema"
src="/home/danny/src/lobo/cruft/util/test/json/schema"
for base in $(ls "${src}"); do
[ -d ${base} ] || continue
echo "testing ${base}"
schema="${base}/schema.json"
for good in $(ls "${base}/good/"*.input.json); do
[ -f "${good}" ] || continue
expected="${good%.input.json}.result.json"
echo "${tool} ${schema} ${good} ${expected}"
done
for bad in $(ls "${base}/bad/"*.json); do
[ -f "${bad}" ] || continue
echo "${tool} ${schema} ${bad}"
done
done

View File

@ -0,0 +1 @@
true

View File

@ -0,0 +1 @@
null

View File

@ -0,0 +1 @@
"foo"

View File

@ -0,0 +1 @@
"foo"

View File

@ -0,0 +1 @@
3.14

View File

@ -0,0 +1 @@
3.14

View File

@ -0,0 +1 @@
3

View File

@ -0,0 +1 @@
[]

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
-1