Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eun committed Jan 24, 2024
1 parent 7d7dfc5 commit 98c94be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func buildStackFrameFromMarker(t *testing.T, fileName, marker string) serrors.St

// Parse the Go file
file, err := parser.ParseFile(fileSet, fileName, nil, parser.AllErrors|parser.ParseComments)
NotEqual(t, nil, err)
Equal(t, nil, err)
packageName := "github.com/Eun/" + file.Name.Name

var inspectNode func(n ast.Node) bool
Expand Down
9 changes: 5 additions & 4 deletions util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"reflect"
"runtime/debug"
"testing"

"github.com/Eun/serrors"
Expand All @@ -22,21 +23,21 @@ func CompareErrorStack(t *testing.T, expected, actual []serrors.ErrorStack) {
}

expectedStack, err := encode(expected)
NotEqual(t, nil, err)
Equal(t, nil, err)
actualStack, err := encode(actual)
NotEqual(t, nil, err)
Equal(t, nil, err)

Equal(t, expectedStack, actualStack)
}

func Equal(t *testing.T, expected, actual any) {
if !reflect.DeepEqual(expected, actual) {
t.Fatalf(`expected %+v, but was %+v`, expected, actual)
t.Fatalf("expected %+v, but was %+v\n%s", expected, actual, string(debug.Stack()))
}
}

func NotEqual(t *testing.T, expected, actual any) {
if reflect.DeepEqual(expected, actual) {
t.Fatalf(`expected not %+v, but was %+v`, expected, actual)
t.Fatalf("expected not %+v, but was %+v\n%s", expected, actual, string(debug.Stack()))
}
}

0 comments on commit 98c94be

Please sign in to comment.