Skip to content

Commit

Permalink
fix: use the correct error comparison function in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
omissis committed May 1, 2023
1 parent 8903ebd commit 9f323ef
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@ import (
"github.com/atombender/go-jsonschema/pkg/generator"
)

var basicConfig = generator.Config{
SchemaMappings: []generator.SchemaMapping{},
ExtraImports: false,
YAMLPackage: "gopkg.in/yaml.v3",
DefaultPackageName: "github.com/example/test",
DefaultOutputName: "-",
ResolveExtensions: []string{".json", ".yaml"},
YAMLExtensions: []string{".yaml", ".yml"},
Warner: func(message string) {
log.Printf("[from warner] %s", message)
},
}
var (
exitErr *exec.ExitError

basicConfig = generator.Config{
SchemaMappings: []generator.SchemaMapping{},
ExtraImports: false,
YAMLPackage: "gopkg.in/yaml.v3",
DefaultPackageName: "github.com/example/test",
DefaultOutputName: "-",
ResolveExtensions: []string{".json", ".yaml"},
YAMLExtensions: []string{".yaml", ".yml"},
Warner: func(message string) {
log.Printf("[from warner] %s", message)
},
}
)

func TestCore(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -244,8 +248,7 @@ func diffStrings(t *testing.T, expected, actual string) (*string, bool) {
fmt.Sprintf("%s/expected", dir),
fmt.Sprintf("%s/actual", dir)).Output()

var exitErr *exec.ExitError
if ok := errors.Is(err, exitErr); !ok {
if !errors.As(err, &exitErr) {
t.Fatal(err.Error())
}

Expand Down

0 comments on commit 9f323ef

Please sign in to comment.