mirror of https://github.com/goccy/go-json.git
Fix helper of testing
This commit is contained in:
parent
015eb040ee
commit
7bcc2071e9
|
@ -6,20 +6,6 @@ import (
|
|||
"github.com/goccy/go-json"
|
||||
)
|
||||
|
||||
func assertErr(t *testing.T, err error) {
|
||||
t.Helper()
|
||||
if err != nil {
|
||||
t.Fatalf("%+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func assertEq(t *testing.T, msg string, exp interface{}, act interface{}) {
|
||||
t.Helper()
|
||||
if exp != act {
|
||||
t.Fatalf("failed to encode %s. exp=[%v] but act=[%v]", msg, exp, act)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Encoder(t *testing.T) {
|
||||
t.Run("int", func(t *testing.T) {
|
||||
bytes, err := json.Marshal(-10)
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package json_test
|
||||
|
||||
import "testing"
|
||||
|
||||
func assertErr(t *testing.T, err error) {
|
||||
t.Helper()
|
||||
if err != nil {
|
||||
t.Fatalf("%+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func assertEq(t *testing.T, msg string, exp interface{}, act interface{}) {
|
||||
t.Helper()
|
||||
if exp != act {
|
||||
t.Fatalf("failed to test for %s. exp=[%v] but act=[%v]", msg, exp, act)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue