Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove testify #1404

Merged
merged 1 commit into from
May 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions formatter/sarif_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"testing"

hcl "github.com/hashicorp/hcl/v2"
"github.com/stretchr/testify/assert"
"github.com/terraform-linters/tflint/tflint"
"github.com/xeipuuv/gojsonschema"
)
Expand Down Expand Up @@ -266,22 +265,25 @@ func Test_sarifPrint(t *testing.T) {
}

for _, tc := range cases {
stdout := &bytes.Buffer{}
stderr := &bytes.Buffer{}
formatter := &Formatter{Stdout: stdout, Stderr: stderr, Format: "sarif"}
t.Run(tc.Name, func(t *testing.T) {
stdout := &bytes.Buffer{}
stderr := &bytes.Buffer{}
formatter := &Formatter{Stdout: stdout, Stderr: stderr, Format: "sarif"}

formatter.Print(tc.Issues, tc.Error, map[string][]byte{})
formatter.Print(tc.Issues, tc.Error, map[string][]byte{})

if stdout.String() != tc.Stdout {
t.Fatalf("Failed %s test: expected=%s, stdout=%s", tc.Name, tc.Stdout, stdout.String())
}
if stdout.String() != tc.Stdout {
t.Fatalf("Failed %s test: expected=%s, stdout=%s", tc.Name, tc.Stdout, stdout.String())
}

schemaLoader := gojsonschema.NewReferenceLoader("http://json.schemastore.org/sarif-2.1.0")
result, err := gojsonschema.Validate(schemaLoader, gojsonschema.NewStringLoader(stdout.String()))

assert.NoError(t, err)
for _, err := range result.Errors() {
t.Error(err)
}
schemaLoader := gojsonschema.NewReferenceLoader("http://json.schemastore.org/sarif-2.1.0")
result, err := gojsonschema.Validate(schemaLoader, gojsonschema.NewStringLoader(stdout.String()))
if err != nil {
t.Error(err)
}
for _, err := range result.Errors() {
t.Error(err)
}
})
}
}
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ require (
github.com/sourcegraph/go-lsp v0.0.0-20200429204803-219e11d77f5d
github.com/sourcegraph/jsonrpc2 v0.1.0
github.com/spf13/afero v1.8.2
github.com/stretchr/testify v1.7.1
github.com/terraform-linters/tflint-plugin-sdk v0.11.0
github.com/xeipuuv/gojsonschema v1.2.0
github.com/zclconf/go-cty v1.10.0
Expand All @@ -48,7 +47,6 @@ require (
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/aws/aws-sdk-go v1.42.43 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-querystring v1.0.0 // indirect
Expand All @@ -66,8 +64,8 @@ require (
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/stretchr/testify v1.7.1 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
Expand All @@ -85,5 +83,4 @@ require (
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)