diff --git a/acceptance_tests/empty.sh b/acceptance_tests/empty.sh index 7ffb813..69cd817 100755 --- a/acceptance_tests/empty.sh +++ b/acceptance_tests/empty.sh @@ -8,7 +8,7 @@ EOL } testEmptyEval() { - X=$(./yq e test.yml) + X=$(./yq e test.yml -v) expected=$(cat test.yml) assertEquals 0 $? assertEquals "$expected" "$X" diff --git a/pkg/yqlib/operators_test.go b/pkg/yqlib/operators_test.go index cc697cf..b43fba8 100644 --- a/pkg/yqlib/operators_test.go +++ b/pkg/yqlib/operators_test.go @@ -11,6 +11,7 @@ import ( "testing" "github.com/mikefarah/yq/v4/test" + "gopkg.in/op/go-logging.v1" yaml "gopkg.in/yaml.v3" ) @@ -26,6 +27,12 @@ type expressionScenario struct { dontFormatInputForDoc bool // dont format input doc for documentation generation } +func TestMain(m *testing.M) { + logging.SetLevel(logging.ERROR, "") + code := m.Run() + os.Exit(code) +} + func NewSimpleYamlPrinter(writer io.Writer, outputFormat PrinterOutputFormat, unwrapScalar bool, colorsEnabled bool, indent int, printDocSeparators bool) Printer { return NewPrinter(NewYamlEncoder(indent, colorsEnabled, printDocSeparators, unwrapScalar), NewSinglePrinterWriter(writer)) } @@ -46,7 +53,6 @@ func readDocumentWithLeadingContent(content string, fakefilename string, fakeFil func testScenario(t *testing.T, s *expressionScenario) { var err error - node, err := NewExpressionParser().ParseExpression(s.expression) if err != nil { t.Error(fmt.Errorf("Error parsing expression %v of %v: %w", s.expression, s.description, err)) diff --git a/scripts/test.sh b/scripts/test.sh index 2ea6262..a18392c 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,3 +1,3 @@ #!/bin/bash -go test -v $(go list ./... | grep -v -E 'examples' | grep -v -E 'test') +go test $(go list ./... | grep -v -E 'examples' | grep -v -E 'test') diff --git a/test.sh b/test.sh deleted file mode 100755 index c4c1e3f..0000000 --- a/test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# load array into a bash array -# need to output each entry as a single line -# readarray identityMappings < <(./yq e -o=j -I=0 '.identitymappings[]' test.yml ) - -# for identityMapping in "${identityMappings[@]}"; do -# # identity mapping is a yaml snippet representing a single entry -# roleArn=$(echo "$identityMapping" | yq e '.arn' -) -# echo "roleArn: $roleArn" -# done - - - - -while IFS=$'\t' read -r roleArn group user _; do - echo "Role: $roleArn" - echo "Group: $group" - echo "User: $user" -done < <(yq -j read test.yaml \ - | jq -r '.identitymappings[] | [.arn, .group, .user] | @tsv') \ No newline at end of file