#!/bin/bash

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

#
# File generated by a command like:
# $ json-gentest -C bugs:40
#

[[ "$1" =~ ^-u[0-9]+$ ]] &&
u="${1:2}" ||
u=""

diff -u$u -L 40.old <(echo \
'$ json() { set -o pipefail && LD_LIBRARY_PATH=../lib ../src/json --terse --verbose --literal-value "$@" 2>&1|sed -r '\''/error:/s|(/dev/fd/)[0-9]+|\1??|'\''; }
$ echo -n|json -Vt <(echo '\''{"type":"object",}'\'') --echo
json: error: /dev/fd/??:1:18: type lib error: parse error: unexpected token
command failed: echo -n|json -Vt <(echo '\''{"type":"object",}'\'') --echo
$ echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --parse
json: error: /dev/fd/??:2:1: type lib error: parse error: unexpected token
command failed: echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --parse
$ echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --pretty
json: error: /dev/fd/??:2:1: type lib error: parse error: unexpected token
command failed: echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --pretty
$ echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --terse
json: error: /dev/fd/??:2:1: type lib error: parse error: unexpected token
command failed: echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --terse
$ echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --echo
json: error: /dev/fd/??:2:1: type lib error: parse error: unexpected token
command failed: echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --echo'
) -L 40.new <(
echo '$ json() { set -o pipefail && LD_LIBRARY_PATH=../lib ../src/json --terse --verbose --literal-value "$@" 2>&1|sed -r '\''/error:/s|(/dev/fd/)[0-9]+|\1??|'\''; }'
json() { set -o pipefail && LD_LIBRARY_PATH=../lib ../src/json --terse --verbose --literal-value "$@" 2>&1|sed -r '/error:/s|(/dev/fd/)[0-9]+|\1??|'; } 2>&1 ||
echo 'command failed: json() { set -o pipefail && LD_LIBRARY_PATH=../lib ../src/json --terse --verbose --literal-value "$@" 2>&1|sed -r '\''/error:/s|(/dev/fd/)[0-9]+|\1??|'\''; }'

echo '$ echo -n|json -Vt <(echo '\''{"type":"object",}'\'') --echo'
echo -n|json -Vt <(echo '{"type":"object",}') --echo 2>&1 ||
echo 'command failed: echo -n|json -Vt <(echo '\''{"type":"object",}'\'') --echo'

echo '$ echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --parse'
echo -n|json -Vt <(echo -e '{"type":"object",\n}') --parse 2>&1 ||
echo 'command failed: echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --parse'

echo '$ echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --pretty'
echo -n|json -Vt <(echo -e '{"type":"object",\n}') --pretty 2>&1 ||
echo 'command failed: echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --pretty'

echo '$ echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --terse'
echo -n|json -Vt <(echo -e '{"type":"object",\n}') --terse 2>&1 ||
echo 'command failed: echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --terse'

echo '$ echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --echo'
echo -n|json -Vt <(echo -e '{"type":"object",\n}') --echo 2>&1 ||
echo 'command failed: echo -n|json -Vt <(echo -e '\''{"type":"object",\n}'\'') --echo'
)

