github.com/3JoB/go-json@v0.10.4/helper_test.go (about)

     1  package json_test
     2  
     3  import "testing"
     4  
     5  func assertErr(t *testing.T, err error) {
     6  	t.Helper()
     7  	if err != nil {
     8  		t.Fatalf("%+v", err)
     9  	}
    10  }
    11  
    12  func assertEq(t *testing.T, msg string, exp any, act any) {
    13  	t.Helper()
    14  	if exp != act {
    15  		t.Fatalf("failed to test for %s. exp=[%v] but act=[%v]", msg, exp, act)
    16  	}
    17  }
    18  
    19  func assertNeq(t *testing.T, msg string, exp any, act any) {
    20  	t.Helper()
    21  	if exp == act {
    22  		t.Fatalf("failed to test for %s. expected value is not [%v] but got same value", msg, act)
    23  	}
    24  }