hurl/integration/bin/format_to_json.sh
2020-11-09 22:32:40 +01:00

20 lines
411 B
Bash
Executable File

#!/bin/bash
# Export AST to json
set -u
set -eo pipefail
for hurl_file in "$@"; do
json_file="${hurl_file%.*}.json"
cmd="hurlfmt --json $hurl_file"
echo "$cmd"
$cmd 2>/tmp/test.stderr >/tmp/test.stdout
expected=$(cat "$json_file")
actual=$(cat /tmp/test.stdout)
if [ "$actual" != "$expected" ]; then
diff <(echo "$actual" ) <(echo "$expected")
exit 1
fi
done