Fix helper of testing

This commit is contained in:
Masaaki Goshima 2020-04-24 20:48:15 +09:00
parent 015eb040ee
commit 7bcc2071e9
2 changed files with 17 additions and 14 deletions

View File

@ -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)

17
helper_test.go Normal file
View File

@ -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)
}
}