# Copyright (C) 2016, 2017, 2018, 2019  Stefan Vargyas
# 
# This file is part of Json-Type.
# 
# Json-Type is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# Json-Type is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Json-Type.  If not, see <http://www.gnu.org/licenses/>.

#
# json-litex path checker test suite:
#

$ . ~/regtest2.sh
$ alias json-litex-checker-regtest='regtest2-selftest -f test-json-litex-checker.txt -a exec=pipe -B'

# output all test names:
$ json-litex-checker-regtest -N
...

# run all tests:
$ json-litex-checker-regtest -A
...

--[ prereq ]--------------------------------------------------------------------

$ [ -n "$JSON_LITEX_TEST_PCRE2_LIB" ] || JSON_LITEX_TEST_PCRE2_LIB="/usr/local/lib"
$ json-litex() { set -o pipefail && LD_LIBRARY_PATH=../lib:"$JSON_LITEX_TEST_PCRE2_LIB" ../src/json --literal-value --parse-only -Vf -- ../lib/json-litex.so "$@"; }
$

--[ const-false ]---------------------------------------------------------------

#
# # meta command:
# $ for f in '%s' '[%s]' '{"foo":%s}' '[[%s]]' '[{"foo":%s}]' '{"foo":[%s]}' '{"foo":{"bar":%s}}' ; do for v in null false true 123 '"zzz"' '[]' '{}'; do printf -v v "$f" "$v"; c="json-litex -d '\"0\"' <<< '$v'"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done; done
#
$ json-litex -d '"0"' <<< 'null'
json: error: <stdin>:1:1: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:1: null
json: error: <stdin>:1:1: ^
command failed: json-litex -d '"0"' <<< 'null'
$ json-litex -d '"0"' <<< 'false'
json: error: <stdin>:1:1: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:1: false
json: error: <stdin>:1:1: ^
command failed: json-litex -d '"0"' <<< 'false'
$ json-litex -d '"0"' <<< 'true'
json: error: <stdin>:1:1: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:1: true
json: error: <stdin>:1:1: ^
command failed: json-litex -d '"0"' <<< 'true'
$ json-litex -d '"0"' <<< '123'
json: error: <stdin>:1:1: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:1: 123
json: error: <stdin>:1:1: ^
command failed: json-litex -d '"0"' <<< '123'
$ json-litex -d '"0"' <<< '"zzz"'
json: error: <stdin>:1:1: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:1: "zzz"
json: error: <stdin>:1:1: ^
command failed: json-litex -d '"0"' <<< '"zzz"'
$ json-litex -d '"0"' <<< '[]'
$ json-litex -d '"0"' <<< '{}'
$ json-litex -d '"0"' <<< '[null]'
json: error: <stdin>:1:2: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:2: [null]
json: error: <stdin>:1:2:  ^
command failed: json-litex -d '"0"' <<< '[null]'
$ json-litex -d '"0"' <<< '[false]'
json: error: <stdin>:1:2: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:2: [false]
json: error: <stdin>:1:2:  ^
command failed: json-litex -d '"0"' <<< '[false]'
$ json-litex -d '"0"' <<< '[true]'
json: error: <stdin>:1:2: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:2: [true]
json: error: <stdin>:1:2:  ^
command failed: json-litex -d '"0"' <<< '[true]'
$ json-litex -d '"0"' <<< '[123]'
json: error: <stdin>:1:2: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:2: [123]
json: error: <stdin>:1:2:  ^
command failed: json-litex -d '"0"' <<< '[123]'
$ json-litex -d '"0"' <<< '["zzz"]'
json: error: <stdin>:1:2: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:2: ["zzz"]
json: error: <stdin>:1:2:  ^
command failed: json-litex -d '"0"' <<< '["zzz"]'
$ json-litex -d '"0"' <<< '[[]]'
$ json-litex -d '"0"' <<< '[{}]'
$ json-litex -d '"0"' <<< '{"foo":null}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":null}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"0"' <<< '{"foo":null}'
$ json-litex -d '"0"' <<< '{"foo":false}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":false}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"0"' <<< '{"foo":false}'
$ json-litex -d '"0"' <<< '{"foo":true}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":true}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"0"' <<< '{"foo":true}'
$ json-litex -d '"0"' <<< '{"foo":123}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":123}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"0"' <<< '{"foo":123}'
$ json-litex -d '"0"' <<< '{"foo":"zzz"}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":"zzz"}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"0"' <<< '{"foo":"zzz"}'
$ json-litex -d '"0"' <<< '{"foo":[]}'
$ json-litex -d '"0"' <<< '{"foo":{}}'
$ json-litex -d '"0"' <<< '[[null]]'
json: error: <stdin>:1:3: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:3: [[null]]
json: error: <stdin>:1:3:   ^
command failed: json-litex -d '"0"' <<< '[[null]]'
$ json-litex -d '"0"' <<< '[[false]]'
json: error: <stdin>:1:3: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:3: [[false]]
json: error: <stdin>:1:3:   ^
command failed: json-litex -d '"0"' <<< '[[false]]'
$ json-litex -d '"0"' <<< '[[true]]'
json: error: <stdin>:1:3: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:3: [[true]]
json: error: <stdin>:1:3:   ^
command failed: json-litex -d '"0"' <<< '[[true]]'
$ json-litex -d '"0"' <<< '[[123]]'
json: error: <stdin>:1:3: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:3: [[123]]
json: error: <stdin>:1:3:   ^
command failed: json-litex -d '"0"' <<< '[[123]]'
$ json-litex -d '"0"' <<< '[["zzz"]]'
json: error: <stdin>:1:3: filter library: path check error: expression falsified: root value -> expression "0"
json: error: <stdin>:1:3: [["zzz"]]
json: error: <stdin>:1:3:   ^
command failed: json-litex -d '"0"' <<< '[["zzz"]]'
$ json-litex -d '"0"' <<< '[[[]]]'
$ json-litex -d '"0"' <<< '[[{}]]'
$ json-litex -d '"0"' <<< '[{"foo":null}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":null}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '[{"foo":null}]'
$ json-litex -d '"0"' <<< '[{"foo":false}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":false}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '[{"foo":false}]'
$ json-litex -d '"0"' <<< '[{"foo":true}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":true}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '[{"foo":true}]'
$ json-litex -d '"0"' <<< '[{"foo":123}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":123}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '[{"foo":123}]'
$ json-litex -d '"0"' <<< '[{"foo":"zzz"}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":"zzz"}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '[{"foo":"zzz"}]'
$ json-litex -d '"0"' <<< '[{"foo":[]}]'
$ json-litex -d '"0"' <<< '[{"foo":{}}]'
$ json-litex -d '"0"' <<< '{"foo":[null]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":[null]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '{"foo":[null]}'
$ json-litex -d '"0"' <<< '{"foo":[false]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":[false]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '{"foo":[false]}'
$ json-litex -d '"0"' <<< '{"foo":[true]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":[true]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '{"foo":[true]}'
$ json-litex -d '"0"' <<< '{"foo":[123]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":[123]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '{"foo":[123]}'
$ json-litex -d '"0"' <<< '{"foo":["zzz"]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":["zzz"]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"0"' <<< '{"foo":["zzz"]}'
$ json-litex -d '"0"' <<< '{"foo":[[]]}'
$ json-litex -d '"0"' <<< '{"foo":[{}]}'
$ json-litex -d '"0"' <<< '{"foo":{"bar":null}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":null}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"0"' <<< '{"foo":{"bar":null}}'
$ json-litex -d '"0"' <<< '{"foo":{"bar":false}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":false}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"0"' <<< '{"foo":{"bar":false}}'
$ json-litex -d '"0"' <<< '{"foo":{"bar":true}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":true}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"0"' <<< '{"foo":{"bar":true}}'
$ json-litex -d '"0"' <<< '{"foo":{"bar":123}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":123}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"0"' <<< '{"foo":{"bar":123}}'
$ json-litex -d '"0"' <<< '{"foo":{"bar":"zzz"}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":"zzz"}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"0"' <<< '{"foo":{"bar":"zzz"}}'
$ json-litex -d '"0"' <<< '{"foo":{"bar":[]}}'
$ json-litex -d '"0"' <<< '{"foo":{"bar":{}}}'
$

--[ const-true ]----------------------------------------------------------------

#
# # meta command:
# $ for f in '%s' '[%s]' '{"foo":%s}' '[[%s]]' '[{"foo":%s}]' '{"foo":[%s]}' '{"foo":{"bar":%s}}' ; do for v in null false true 123 '"zzz"' '[]' '{}'; do printf -v v "$f" "$v"; c="json-litex -d '\"1\"' <<< '$v'"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done; done
#
$ json-litex -d '"1"' <<< 'null'
$ json-litex -d '"1"' <<< 'false'
$ json-litex -d '"1"' <<< 'true'
$ json-litex -d '"1"' <<< '123'
$ json-litex -d '"1"' <<< '"zzz"'
$ json-litex -d '"1"' <<< '[]'
$ json-litex -d '"1"' <<< '{}'
$ json-litex -d '"1"' <<< '[null]'
$ json-litex -d '"1"' <<< '[false]'
$ json-litex -d '"1"' <<< '[true]'
$ json-litex -d '"1"' <<< '[123]'
$ json-litex -d '"1"' <<< '["zzz"]'
$ json-litex -d '"1"' <<< '[[]]'
$ json-litex -d '"1"' <<< '[{}]'
$ json-litex -d '"1"' <<< '{"foo":null}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":null}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"1"' <<< '{"foo":null}'
$ json-litex -d '"1"' <<< '{"foo":false}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":false}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"1"' <<< '{"foo":false}'
$ json-litex -d '"1"' <<< '{"foo":true}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":true}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"1"' <<< '{"foo":true}'
$ json-litex -d '"1"' <<< '{"foo":123}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":123}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"1"' <<< '{"foo":123}'
$ json-litex -d '"1"' <<< '{"foo":"zzz"}'
json: error: <stdin>:1:8: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:8: {"foo":"zzz"}
json: error: <stdin>:1:8:        ^
command failed: json-litex -d '"1"' <<< '{"foo":"zzz"}'
$ json-litex -d '"1"' <<< '{"foo":[]}'
$ json-litex -d '"1"' <<< '{"foo":{}}'
$ json-litex -d '"1"' <<< '[[null]]'
$ json-litex -d '"1"' <<< '[[false]]'
$ json-litex -d '"1"' <<< '[[true]]'
$ json-litex -d '"1"' <<< '[[123]]'
$ json-litex -d '"1"' <<< '[["zzz"]]'
$ json-litex -d '"1"' <<< '[[[]]]'
$ json-litex -d '"1"' <<< '[[{}]]'
$ json-litex -d '"1"' <<< '[{"foo":null}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":null}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '[{"foo":null}]'
$ json-litex -d '"1"' <<< '[{"foo":false}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":false}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '[{"foo":false}]'
$ json-litex -d '"1"' <<< '[{"foo":true}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":true}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '[{"foo":true}]'
$ json-litex -d '"1"' <<< '[{"foo":123}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":123}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '[{"foo":123}]'
$ json-litex -d '"1"' <<< '[{"foo":"zzz"}]'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: [{"foo":"zzz"}]
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '[{"foo":"zzz"}]'
$ json-litex -d '"1"' <<< '[{"foo":[]}]'
$ json-litex -d '"1"' <<< '[{"foo":{}}]'
$ json-litex -d '"1"' <<< '{"foo":[null]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":[null]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '{"foo":[null]}'
$ json-litex -d '"1"' <<< '{"foo":[false]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":[false]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '{"foo":[false]}'
$ json-litex -d '"1"' <<< '{"foo":[true]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":[true]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '{"foo":[true]}'
$ json-litex -d '"1"' <<< '{"foo":[123]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":[123]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '{"foo":[123]}'
$ json-litex -d '"1"' <<< '{"foo":["zzz"]}'
json: error: <stdin>:1:9: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:9: {"foo":["zzz"]}
json: error: <stdin>:1:9:         ^
command failed: json-litex -d '"1"' <<< '{"foo":["zzz"]}'
$ json-litex -d '"1"' <<< '{"foo":[[]]}'
$ json-litex -d '"1"' <<< '{"foo":[{}]}'
$ json-litex -d '"1"' <<< '{"foo":{"bar":null}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":null}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"1"' <<< '{"foo":{"bar":null}}'
$ json-litex -d '"1"' <<< '{"foo":{"bar":false}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":false}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"1"' <<< '{"foo":{"bar":false}}'
$ json-litex -d '"1"' <<< '{"foo":{"bar":true}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":true}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"1"' <<< '{"foo":{"bar":true}}'
$ json-litex -d '"1"' <<< '{"foo":{"bar":123}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":123}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"1"' <<< '{"foo":{"bar":123}}'
$ json-litex -d '"1"' <<< '{"foo":{"bar":"zzz"}}'
json: error: <stdin>:1:15: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:15: {"foo":{"bar":"zzz"}}
json: error: <stdin>:1:15:               ^
command failed: json-litex -d '"1"' <<< '{"foo":{"bar":"zzz"}}'
$ json-litex -d '"1"' <<< '{"foo":{"bar":[]}}'
$ json-litex -d '"1"' <<< '{"foo":{"bar":{}}}'
$

--[ text-litex-lib ]------------------------------------------------------------

$ shopt -s expand_aliases
$ alias json-litex='json-litex -p ../lib/test-litex.json'
$ json-litex <<< '{}'
$ json-litex <<< '{"a":null}'
json: error: <stdin>:1:6: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:6: {"a":null}
json: error: <stdin>:1:6:      ^
command failed: json-litex <<< '{"a":null}'
$ json-litex <<< '{"e":null}'
json: error: <stdin>:1:6: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:6: {"e":null}
json: error: <stdin>:1:6:      ^
command failed: json-litex <<< '{"e":null}'
$ json-litex <<< '{"a":{"b":{}}}'
$ json-litex <<< '{"a":{"b":[]}}'
$ json-litex <<< '{"a":{"b":""}}'
$ json-litex <<< '{"a":{"b":"\u007f"}}'
$ json-litex <<< '{"a":{"b":"\u0080"}}'
json: error: <stdin>:1:11: filter library: path check error: expression falsified: value at "/a/b" -> expression "/^[[:ascii:]]*$/ && #`\n` <= 1"
json: error: <stdin>:1:11: {"a":{"b":"\\u0080"}}
json: error: <stdin>:1:11:           ^
command failed: json-litex <<< '{"a":{"b":"\u0080"}}'
$ json-litex <<< '{"a":{"b":"foo\nbar"}}'
$ json-litex <<< '{"a":{"b":"foo\n\nbar"}}'
json: error: <stdin>:1:11: filter library: path check error: expression falsified: value at "/a/b" -> expression "/^[[:ascii:]]*$/ && #`\n` <= 1"
json: error: <stdin>:1:11: {"a":{"b":"foo\\n\\nbar"}}
json: error: <stdin>:1:11:           ^
command failed: json-litex <<< '{"a":{"b":"foo\n\nbar"}}'
$ json-litex <<< '{"c":{}}'
$ json-litex <<< '{"c":{"d":null}}'
$ json-litex <<< '{"c":{"d":123}}'
json: error: <stdin>:1:11: filter library: path check error: expression falsified: value at "/c/d" -> expression "null || date(`%Y-%m-%d`)"
json: error: <stdin>:1:11: {"c":{"d":123}}
json: error: <stdin>:1:11:           ^
command failed: json-litex <<< '{"c":{"d":123}}'
$ json-litex <<< '{"c":[{"d":"2018-09-10"},{"d":456}]}'
json: error: <stdin>:1:31: filter library: path check error: expression falsified: value at "/c/d" -> expression "null || date(`%Y-%m-%d`)"
json: error: <stdin>:1:31: {"c":[{"d":"2018-09-10"},{"d":456}]}
json: error: <stdin>:1:31:                               ^
command failed: json-litex <<< '{"c":[{"d":"2018-09-10"},{"d":456}]}'
$

--[ sobj-litex-lib ]------------------------------------------------------------

$ shopt -s expand_aliases
$ alias json-litex='json-litex -p ../lib/test-litex.so'
$ json-litex <<< '{}'
$ json-litex <<< '{"a":null}'
json: error: <stdin>:1:6: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:6: {"a":null}
json: error: <stdin>:1:6:      ^
command failed: json-litex <<< '{"a":null}'
$ json-litex <<< '{"e":null}'
json: error: <stdin>:1:6: filter library: path check error: unexpected JSON literal
json: error: <stdin>:1:6: {"e":null}
json: error: <stdin>:1:6:      ^
command failed: json-litex <<< '{"e":null}'
$ json-litex <<< '{"a":{"b":{}}}'
$ json-litex <<< '{"a":{"b":[]}}'
$ json-litex <<< '{"a":{"b":""}}'
$ json-litex <<< '{"a":{"b":"\u007f"}}'
$ json-litex <<< '{"a":{"b":"\u0080"}}'
json: error: <stdin>:1:11: filter library: path check error: expression falsified: value at "/a/b" -> expression "/^[[:ascii:]]*$/ && #`\n` <= 1"
json: error: <stdin>:1:11: {"a":{"b":"\\u0080"}}
json: error: <stdin>:1:11:           ^
command failed: json-litex <<< '{"a":{"b":"\u0080"}}'
$ json-litex <<< '{"a":{"b":"foo\nbar"}}'
$ json-litex <<< '{"a":{"b":"foo\n\nbar"}}'
json: error: <stdin>:1:11: filter library: path check error: expression falsified: value at "/a/b" -> expression "/^[[:ascii:]]*$/ && #`\n` <= 1"
json: error: <stdin>:1:11: {"a":{"b":"foo\\n\\nbar"}}
json: error: <stdin>:1:11:           ^
command failed: json-litex <<< '{"a":{"b":"foo\n\nbar"}}'
$ json-litex <<< '{"c":{}}'
$ json-litex <<< '{"c":{"d":null}}'
$ json-litex <<< '{"c":{"d":123}}'
json: error: <stdin>:1:11: filter library: path check error: expression falsified: value at "/c/d" -> expression "null || date(`%Y-%m-%d`)"
json: error: <stdin>:1:11: {"c":{"d":123}}
json: error: <stdin>:1:11:           ^
command failed: json-litex <<< '{"c":{"d":123}}'
$ json-litex <<< '{"c":[{"d":"2018-09-10"},{"d":456}]}'
json: error: <stdin>:1:31: filter library: path check error: expression falsified: value at "/c/d" -> expression "null || date(`%Y-%m-%d`)"
json: error: <stdin>:1:31: {"c":[{"d":"2018-09-10"},{"d":456}]}
json: error: <stdin>:1:31:                               ^
command failed: json-litex <<< '{"c":[{"d":"2018-09-10"},{"d":456}]}'
$


