mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 05:38:04 +00:00
fixed create doc for eval-all
This commit is contained in:
parent
cf4915d786
commit
773b1a3517
@ -73,7 +73,7 @@ func evaluateAll(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
if nullInput {
|
if nullInput {
|
||||||
err = allAtOnceEvaluator.EvaluateFiles(args[0], []string{}, printer)
|
err = yqlib.NewStreamEvaluator().EvaluateNew(args[0], printer)
|
||||||
} else {
|
} else {
|
||||||
err = allAtOnceEvaluator.EvaluateFiles("", []string{args[0]}, printer)
|
err = allAtOnceEvaluator.EvaluateFiles("", []string{args[0]}, printer)
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ set -e
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "test eval-sequence"
|
||||||
random=$((1 + $RANDOM % 10))
|
random=$((1 + $RANDOM % 10))
|
||||||
./yq e -n ".a = $random" > test.yml
|
./yq e -n ".a = $random" > test.yml
|
||||||
X=$(./yq e '.a' test.yml)
|
X=$(./yq e '.a' test.yml)
|
||||||
@ -15,7 +16,9 @@ if [[ $X != $random ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "created yaml successfully"
|
echo "--success"
|
||||||
|
|
||||||
|
echo "test update-in-place"
|
||||||
|
|
||||||
update=$(($random + 1))
|
update=$(($random + 1))
|
||||||
./yq e -i ".a = $update" test.yml
|
./yq e -i ".a = $update" test.yml
|
||||||
@ -26,24 +29,36 @@ if [[ $X != $update ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "updated in place successfully"
|
echo "--success"
|
||||||
|
|
||||||
X=$(./yq e '.z' test.yml)
|
echo "test eval-all"
|
||||||
echo "no exit status success"
|
./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
|
set +e
|
||||||
|
|
||||||
X=$(./yq e -e '.z' test.yml)
|
./yq e -e '.z' test.yml
|
||||||
|
|
||||||
if [[ $? != 1 ]]; then
|
if [[ $? != 1 ]]; then
|
||||||
echo "Expected error code 1 but was $?"
|
echo "Expected error code 1 but was $?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "exit status success"
|
echo "--success"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
rm test.yml
|
rm test.yml
|
||||||
|
rm test-eval-all.yml
|
||||||
echo "acceptance tests passed"
|
echo "acceptance tests passed"
|
||||||
|
Loading…
Reference in New Issue
Block a user