#!/bin/bash setUp() { rm test*.yml || true } testBasicEvalRoundTrip() { ./yq e -n ".a = 123" > test.yml X=$(./yq e '.a' test.yml) assertEquals 123 "$X" } testBasicEvalRoundTripNoEval() { ./yq -n ".a = 123" > test.yml X=$(./yq '.a' test.yml) assertEquals 123 "$X" } testBasicStdInWithOneArg() { ./yq e -n ".a = 123" > test.yml X=$(cat test.yml | ./yq e ".a") assertEquals 123 "$X" X=$(cat test.yml | ./yq ea ".a") assertEquals 123 "$X" X=$(cat test.yml | ./yq ".a") assertEquals 123 "$X" } testBasicUpdateInPlaceSequence() { cat >test.yml <test.yml <test.yml < test.yml X=$(./yq e '.z' test.yml) assertEquals "null" "$X" } testBasicExitStatus() { echo "a: cat" > test.yml X=$(./yq e -e '.z' test.yml 2&>/dev/null) assertEquals 1 "$?" } testBasicExitStatusNoEval() { echo "a: cat" > test.yml X=$(./yq -e '.z' test.yml 2&>/dev/null) assertEquals 1 "$?" } testBasicExtractFieldWithSeperator() { cat >test.yml <test.yml <