shellcheck

This commit is contained in:
Mike Farah 2021-07-18 17:05:12 +10:00
parent 7474ac62ef
commit 85bbbbeed4
5 changed files with 12 additions and 13 deletions

View File

@ -5,10 +5,9 @@ setUp() {
} }
testBasicEvalRoundTrip() { testBasicEvalRoundTrip() {
random=$((1 + $RANDOM % 10)) ./yq e -n ".a = 123" > test.yml
./yq e -n ".a = $random" > test.yml
X=$(./yq e '.a' test.yml) X=$(./yq e '.a' test.yml)
assertEquals $random $X assertEquals 123 "$X"
} }
testBasicUpdateInPlaceSequence() { testBasicUpdateInPlaceSequence() {
@ -17,7 +16,7 @@ a: 0
EOL EOL
./yq e -i ".a = 10" test.yml ./yq e -i ".a = 10" test.yml
X=$(./yq e '.a' test.yml) X=$(./yq e '.a' test.yml)
assertEquals "10" $X assertEquals "10" "$X"
} }
testBasicUpdateInPlaceSequenceEvalAll() { testBasicUpdateInPlaceSequenceEvalAll() {
@ -26,19 +25,19 @@ a: 0
EOL EOL
./yq ea -i ".a = 10" test.yml ./yq ea -i ".a = 10" test.yml
X=$(./yq e '.a' test.yml) X=$(./yq e '.a' test.yml)
assertEquals "10" $X assertEquals "10" "$X"
} }
testBasicNoExitStatus() { testBasicNoExitStatus() {
echo "a: cat" > test.yml echo "a: cat" > test.yml
X=$(./yq e '.z' test.yml) X=$(./yq e '.z' test.yml)
assertEquals "null" $X assertEquals "null" "$X"
} }
testBasicExitStatus() { testBasicExitStatus() {
echo "a: cat" > test.yml echo "a: cat" > test.yml
X=$(./yq e -e '.z' test.yml 2&>/dev/null) X=$(./yq e -e '.z' test.yml 2&>/dev/null)
assertEquals 1 $? assertEquals 1 "$?"
} }
source ./scripts/shunit2 source ./scripts/shunit2

View File

@ -12,7 +12,7 @@ testEmptyEval() {
} }
testEmptyEvalPipe() { testEmptyEvalPipe() {
X=$(cat test.yml | ./yq e -) X=$(./yq e - < test.yml)
assertEquals 0 $? assertEquals 0 $?
} }

View File

@ -8,7 +8,7 @@ EOL
} }
testLeadingSeperatorPipeIntoEvalSeq() { testLeadingSeperatorPipeIntoEvalSeq() {
X=$(cat test.yml | ./yq e -) X=$(./yq e - < test.yml)
expected=$(cat test.yml) expected=$(cat test.yml)
assertEquals "$expected" "$X" assertEquals "$expected" "$X"
} }
@ -21,7 +21,7 @@ testLeadingSeperatorEvalSeq() {
} }
testLeadingSeperatorPipeIntoEvalAll() { testLeadingSeperatorPipeIntoEvalAll() {
X=$(cat test.yml | ./yq ea -) X=$(./yq ea - < test.yml)
expected=$(cat test.yml) expected=$(cat test.yml)
assertEquals "$expected" "$X" assertEquals "$expected" "$X"
} }

View File

@ -5,6 +5,6 @@ for test in acceptance_tests/*.sh; do
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"
echo "$test" echo "$test"
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"
(exec $test); (exec "$test");
done done

View File

@ -5,7 +5,7 @@ set -o pipefail
if command -v gosec &> /dev/null if command -v gosec &> /dev/null
then then
gosec ${PWD} ./... gosec "${PWD}" ./...
else else
./bin/gosec ${PWD} ./... ./bin/gosec "${PWD}" ./...
fi fi