fixed create doc for eval-all

This commit is contained in:
Mike Farah 2020-12-01 14:23:27 +11:00
parent cf4915d786
commit 773b1a3517
2 changed files with 23 additions and 8 deletions

View File

@ -73,7 +73,7 @@ func evaluateAll(cmd *cobra.Command, args []string) error {
}
case 1:
if nullInput {
err = allAtOnceEvaluator.EvaluateFiles(args[0], []string{}, printer)
err = yqlib.NewStreamEvaluator().EvaluateNew(args[0], printer)
} else {
err = allAtOnceEvaluator.EvaluateFiles("", []string{args[0]}, printer)
}

View File

@ -6,6 +6,7 @@ set -e
echo "test eval-sequence"
random=$((1 + $RANDOM % 10))
./yq e -n ".a = $random" > test.yml
X=$(./yq e '.a' test.yml)
@ -15,7 +16,9 @@ if [[ $X != $random ]]; then
exit 1
fi
echo "created yaml successfully"
echo "--success"
echo "test update-in-place"
update=$(($random + 1))
./yq e -i ".a = $update" test.yml
@ -26,24 +29,36 @@ if [[ $X != $update ]]; then
exit 1
fi
echo "updated in place successfully"
echo "--success"
X=$(./yq e '.z' test.yml)
echo "no exit status success"
echo "test eval-all"
./yq ea -n ".a = $random" > test-eval-all.yml
Y=$(./yq ea '.a' test-eval-all.yml)
if [[ $Y != $random ]]; then
echo "Failed create with eval all: expected $random but was $X"
exit 1
fi
echo "--success"
echo "test no exit status"
./yq e '.z' test.yml
echo "--success"
echo "test exit status"
set +e
X=$(./yq e -e '.z' test.yml)
./yq e -e '.z' test.yml
if [[ $? != 1 ]]; then
echo "Expected error code 1 but was $?"
exit 1
fi
echo "exit status success"
echo "--success"
set -e
rm test.yml
rm test-eval-all.yml
echo "acceptance tests passed"