cql2 0.6.0

Parse, validate, and convert Common Query Language (CQL2) text and JSON
Documentation
#!/usr/bin/env sh
#
# Regenerates the expected output in each tests/expected/*.out file.
#
# Each file holds three lines:
#   1. the input, in cql2-text or cql2-json
#   2. the expected cql2-text output
#   3. the expected cql2-json output
#
# Only lines 2 and 3 are rewritten. The input is preserved byte for byte, so the diff shows nothing
# but the change in output.

set -e

cargo build

tests=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
root=$(dirname "$tests")
cql2="$root/target/debug/cql2"

for path in "$tests"/expected/*.out; do
    input=$(head -1 "$path")
    text=$(printf '%s\n' "$input" | "$cql2" --output-format text)
    json=$(printf '%s\n' "$input" | "$cql2" --output-format json)
    printf '%s\n%s\n%s\n' "$input" "$text" "$json" > "$path"
done