op_test.go 412 B

1234567891011121314151617
  1. package test
  2. import (
  3. "github.com/modern-go/reflect2"
  4. "testing"
  5. "github.com/v2pro/plz/countlog"
  6. "github.com/v2pro/plz/test/must"
  7. "github.com/v2pro/plz/test"
  8. )
  9. func testOp(f func(api reflect2.API) interface{}) func(t *testing.T) {
  10. return test.Case(func(ctx *countlog.Context) {
  11. unsafeResult := f(reflect2.ConfigUnsafe)
  12. safeResult := f(reflect2.ConfigSafe)
  13. must.Equal(safeResult, unsafeResult)
  14. })
  15. }