event: merge bench and eventtest, and put it in the right place
Change-Id: I382371f0abe3665171a62047157106923ddc6c19
Reviewed-on: https://go-review.googlesource.com/c/exp/+/327753
Trust: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/event/adapter/gokit/bench_test.go b/event/adapter/gokit/bench_test.go
index 7d2fb3e..2313abb 100644
--- a/event/adapter/gokit/bench_test.go
+++ b/event/adapter/gokit/bench_test.go
@@ -11,32 +11,31 @@
"testing"
"github.com/go-kit/kit/log"
- "golang.org/x/exp/event/adapter/eventtest"
"golang.org/x/exp/event/adapter/logfmt"
- "golang.org/x/exp/event/bench"
+ "golang.org/x/exp/event/eventtest"
)
var (
- gokitLog = bench.Hooks{
+ gokitLog = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- gokitCtx(ctx).Log(bench.A.Name, a, "msg", bench.A.Msg)
+ gokitCtx(ctx).Log(eventtest.A.Name, a, "msg", eventtest.A.Msg)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- gokitCtx(ctx).Log(bench.B.Name, b, "msg", bench.B.Msg)
+ gokitCtx(ctx).Log(eventtest.B.Name, b, "msg", eventtest.B.Msg)
return ctx
},
BEnd: func(ctx context.Context) {},
}
- gokitLogf = bench.Hooks{
+ gokitLogf = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- gokitCtx(ctx).Log("msg", fmt.Sprintf(bench.A.Msgf, a))
+ gokitCtx(ctx).Log("msg", fmt.Sprintf(eventtest.A.Msgf, a))
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- gokitCtx(ctx).Log("msg", fmt.Sprintf(bench.B.Msgf, b))
+ gokitCtx(ctx).Log("msg", fmt.Sprintf(eventtest.B.Msgf, b))
return ctx
},
BEnd: func(ctx context.Context) {},
@@ -57,16 +56,16 @@
}
func BenchmarkGokitLogDiscard(b *testing.B) {
- bench.RunBenchmark(b, gokitPrint(io.Discard), gokitLog)
+ eventtest.RunBenchmark(b, gokitPrint(io.Discard), gokitLog)
}
func BenchmarkGokitLogfDiscard(b *testing.B) {
- bench.RunBenchmark(b, gokitPrint(io.Discard), gokitLogf)
+ eventtest.RunBenchmark(b, gokitPrint(io.Discard), gokitLogf)
}
func TestGokitLogfDiscard(t *testing.T) {
- bench.TestBenchmark(t, gokitPrint, gokitLogf, bench.LogfOutput)
+ eventtest.TestBenchmark(t, gokitPrint, gokitLogf, eventtest.LogfOutput)
}
func TestLogGokit(t *testing.T) {
- bench.TestBenchmark(t, gokitPrint, gokitLog, bench.LogfmtOutput)
+ eventtest.TestBenchmark(t, gokitPrint, gokitLog, eventtest.LogfmtOutput)
}
diff --git a/event/adapter/gokit/gokit_test.go b/event/adapter/gokit/gokit_test.go
index 3e88d3b..d2b5390 100644
--- a/event/adapter/gokit/gokit_test.go
+++ b/event/adapter/gokit/gokit_test.go
@@ -11,8 +11,8 @@
"github.com/google/go-cmp/cmp"
"golang.org/x/exp/event"
- "golang.org/x/exp/event/adapter/eventtest"
"golang.org/x/exp/event/adapter/gokit"
+ "golang.org/x/exp/event/eventtest"
"golang.org/x/exp/event/keys"
)
diff --git a/event/adapter/logr/logr_test.go b/event/adapter/logr/logr_test.go
index 29599c5..c35fe9a 100644
--- a/event/adapter/logr/logr_test.go
+++ b/event/adapter/logr/logr_test.go
@@ -11,8 +11,8 @@
"github.com/google/go-cmp/cmp"
"golang.org/x/exp/event"
- "golang.org/x/exp/event/adapter/eventtest"
elogr "golang.org/x/exp/event/adapter/logr"
+ "golang.org/x/exp/event/eventtest"
"golang.org/x/exp/event/keys"
"golang.org/x/exp/event/severity"
)
diff --git a/event/adapter/logrus/bench_test.go b/event/adapter/logrus/bench_test.go
index ce741ff..da9f5d6 100644
--- a/event/adapter/logrus/bench_test.go
+++ b/event/adapter/logrus/bench_test.go
@@ -11,32 +11,31 @@
"time"
"github.com/sirupsen/logrus"
- "golang.org/x/exp/event/adapter/eventtest"
- "golang.org/x/exp/event/bench"
+ "golang.org/x/exp/event/eventtest"
)
var (
- logrusLog = bench.Hooks{
+ logrusLog = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- logrusCtx(ctx).WithField(bench.A.Name, a).Info(bench.A.Msg)
+ logrusCtx(ctx).WithField(eventtest.A.Name, a).Info(eventtest.A.Msg)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- logrusCtx(ctx).WithField(bench.B.Name, b).Info(bench.B.Msg)
+ logrusCtx(ctx).WithField(eventtest.B.Name, b).Info(eventtest.B.Msg)
return ctx
},
BEnd: func(ctx context.Context) {},
}
- logrusLogf = bench.Hooks{
+ logrusLogf = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- logrusCtx(ctx).Infof(bench.A.Msgf, a)
+ logrusCtx(ctx).Infof(eventtest.A.Msgf, a)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- logrusCtx(ctx).Infof(bench.B.Msgf, b)
+ logrusCtx(ctx).Infof(eventtest.B.Msgf, b)
return ctx
},
BEnd: func(ctx context.Context) {},
@@ -66,7 +65,7 @@
now: eventtest.ExporterOptions().Now,
wrapped: &logrus.TextFormatter{
FullTimestamp: true,
- TimestampFormat: bench.TimeFormat,
+ TimestampFormat: eventtest.TimeFormat,
DisableSorting: true,
DisableColors: true,
},
@@ -76,13 +75,13 @@
}
func BenchmarkLogrusLogDiscard(b *testing.B) {
- bench.RunBenchmark(b, logrusPrint(io.Discard), logrusLog)
+ eventtest.RunBenchmark(b, logrusPrint(io.Discard), logrusLog)
}
func BenchmarkLogrusLogfDiscard(b *testing.B) {
- bench.RunBenchmark(b, logrusPrint(io.Discard), logrusLogf)
+ eventtest.RunBenchmark(b, logrusPrint(io.Discard), logrusLogf)
}
func TestLogrusf(t *testing.T) {
- bench.TestBenchmark(t, logrusPrint, logrusLogf, bench.LogfOutput)
+ eventtest.TestBenchmark(t, logrusPrint, logrusLogf, eventtest.LogfOutput)
}
diff --git a/event/adapter/logrus/logrus_test.go b/event/adapter/logrus/logrus_test.go
index efbac64..b2249af 100644
--- a/event/adapter/logrus/logrus_test.go
+++ b/event/adapter/logrus/logrus_test.go
@@ -14,8 +14,8 @@
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/sirupsen/logrus"
"golang.org/x/exp/event"
- "golang.org/x/exp/event/adapter/eventtest"
elogrus "golang.org/x/exp/event/adapter/logrus"
+ "golang.org/x/exp/event/eventtest"
"golang.org/x/exp/event/keys"
"golang.org/x/exp/event/severity"
)
diff --git a/event/bench/stdlib_test.go b/event/adapter/stdlib/bench_test.go
similarity index 79%
rename from event/bench/stdlib_test.go
rename to event/adapter/stdlib/bench_test.go
index 7b99c74..35cdd29 100644
--- a/event/bench/stdlib_test.go
+++ b/event/adapter/stdlib/bench_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package bench_test
+package stdlib_test
import (
"context"
@@ -12,39 +12,38 @@
"log"
"testing"
- "golang.org/x/exp/event/adapter/eventtest"
- "golang.org/x/exp/event/bench"
+ "golang.org/x/exp/event/eventtest"
)
var (
- baseline = bench.Hooks{
+ baseline = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context { return ctx },
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context { return ctx },
BEnd: func(ctx context.Context) {},
}
- stdlibLog = bench.Hooks{
+ stdlibLog = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- logCtx(ctx).Printf(bench.A.Msgf, a)
+ logCtx(ctx).Printf(eventtest.A.Msgf, a)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- logCtx(ctx).Printf(bench.B.Msgf, b)
+ logCtx(ctx).Printf(eventtest.B.Msgf, b)
return ctx
},
BEnd: func(ctx context.Context) {},
}
- stdlibPrintf = bench.Hooks{
+ stdlibPrintf = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- ctxPrintf(ctx, bench.A.Msgf, a)
+ ctxPrintf(ctx, eventtest.A.Msgf, a)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- ctxPrintf(ctx, bench.B.Msgf, b)
+ ctxPrintf(ctx, eventtest.B.Msgf, b)
return ctx
},
BEnd: func(ctx context.Context) {},
@@ -52,7 +51,7 @@
)
func BenchmarkBaseline(b *testing.B) {
- bench.RunBenchmark(b, context.Background(), bench.Hooks{
+ eventtest.RunBenchmark(b, context.Background(), eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context { return ctx },
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context { return ctx },
@@ -88,22 +87,22 @@
return context.WithValue(context.Background(), writerKey{},
func(msg string, args ...interface{}) {
fmt.Fprintf(w, "time=%q level=info msg=%q\n",
- now().Format(bench.TimeFormat),
+ now().Format(eventtest.TimeFormat),
fmt.Sprintf(msg, args...))
},
)
}
func BenchmarkStdlibLogfDiscard(b *testing.B) {
- bench.RunBenchmark(b, stdlibLogger(ioutil.Discard), stdlibLog)
+ eventtest.RunBenchmark(b, stdlibLogger(ioutil.Discard), stdlibLog)
}
func BenchmarkStdlibPrintfDiscard(b *testing.B) {
- bench.RunBenchmark(b, stdlibWriter(io.Discard), stdlibPrintf)
+ eventtest.RunBenchmark(b, stdlibWriter(io.Discard), stdlibPrintf)
}
func TestLogStdlib(t *testing.T) {
- bench.TestBenchmark(t, stdlibLoggerNoTime, stdlibLog, `
+ eventtest.TestBenchmark(t, stdlibLoggerNoTime, stdlibLog, `
a where A=0
b where B="A value"
a where A=1
@@ -124,5 +123,5 @@
}
func TestLogPrintf(t *testing.T) {
- bench.TestBenchmark(t, stdlibWriter, stdlibPrintf, bench.LogfOutput)
+ eventtest.TestBenchmark(t, stdlibWriter, stdlibPrintf, eventtest.LogfOutput)
}
diff --git a/event/adapter/zap/bench_test.go b/event/adapter/zap/bench_test.go
index 85b8050..913747f 100644
--- a/event/adapter/zap/bench_test.go
+++ b/event/adapter/zap/bench_test.go
@@ -12,31 +12,30 @@
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
- "golang.org/x/exp/event/adapter/eventtest"
- "golang.org/x/exp/event/bench"
+ "golang.org/x/exp/event/eventtest"
)
var (
- zapLog = bench.Hooks{
+ zapLog = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- zapCtx(ctx).Info(bench.A.Msg, zap.Int(bench.A.Name, a))
+ zapCtx(ctx).Info(eventtest.A.Msg, zap.Int(eventtest.A.Name, a))
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- zapCtx(ctx).Info(bench.B.Msg, zap.String(bench.B.Name, b))
+ zapCtx(ctx).Info(eventtest.B.Msg, zap.String(eventtest.B.Name, b))
return ctx
},
BEnd: func(ctx context.Context) {},
}
- zapLogf = bench.Hooks{
+ zapLogf = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- zapCtx(ctx).Sugar().Infof(bench.A.Msgf, a)
+ zapCtx(ctx).Sugar().Infof(eventtest.A.Msgf, a)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- zapCtx(ctx).Sugar().Infof(bench.B.Msgf, b)
+ zapCtx(ctx).Sugar().Infof(eventtest.B.Msgf, b)
return ctx
},
BEnd: func(ctx context.Context) {},
@@ -53,7 +52,7 @@
now := eventtest.ExporterOptions().Now
ec := zap.NewProductionEncoderConfig()
ec.EncodeDuration = zapcore.NanosDurationEncoder
- timeEncoder := zapcore.TimeEncoderOfLayout(bench.TimeFormat)
+ timeEncoder := zapcore.TimeEncoderOfLayout(eventtest.TimeFormat)
ec.EncodeTime = func(_ time.Time, a zapcore.PrimitiveArrayEncoder) {
timeEncoder(now(), a)
}
@@ -67,15 +66,15 @@
}
func BenchmarkZapLogDiscard(b *testing.B) {
- bench.RunBenchmark(b, zapPrint(io.Discard), zapLog)
+ eventtest.RunBenchmark(b, zapPrint(io.Discard), zapLog)
}
func BenchmarkZapLogfDiscard(b *testing.B) {
- bench.RunBenchmark(b, zapPrint(io.Discard), zapLogf)
+ eventtest.RunBenchmark(b, zapPrint(io.Discard), zapLogf)
}
func TestZapLogfDiscard(t *testing.T) {
- bench.TestBenchmark(t, zapPrint, zapLogf, `
+ eventtest.TestBenchmark(t, zapPrint, zapLogf, `
2020/03/05 14:27:48 info a where A=0
2020/03/05 14:27:49 info b where B="A value"
2020/03/05 14:27:50 info a where A=1
@@ -95,7 +94,7 @@
`)
}
func TestLogZap(t *testing.T) {
- bench.TestBenchmark(t, zapPrint, zapLog, `
+ eventtest.TestBenchmark(t, zapPrint, zapLog, `
2020/03/05 14:27:48 info a {"A": 0}
2020/03/05 14:27:49 info b {"B": "A value"}
2020/03/05 14:27:50 info a {"A": 1}
diff --git a/event/adapter/zap/zap_test.go b/event/adapter/zap/zap_test.go
index ffc0c67..c504434 100644
--- a/event/adapter/zap/zap_test.go
+++ b/event/adapter/zap/zap_test.go
@@ -13,8 +13,8 @@
"github.com/google/go-cmp/cmp/cmpopts"
"go.uber.org/zap"
"golang.org/x/exp/event"
- "golang.org/x/exp/event/adapter/eventtest"
ezap "golang.org/x/exp/event/adapter/zap"
+ "golang.org/x/exp/event/eventtest"
"golang.org/x/exp/event/keys"
"golang.org/x/exp/event/severity"
)
diff --git a/event/adapter/zerolog/bench_test.go b/event/adapter/zerolog/bench_test.go
index 3c49770..480754d 100644
--- a/event/adapter/zerolog/bench_test.go
+++ b/event/adapter/zerolog/bench_test.go
@@ -10,32 +10,31 @@
"testing"
"github.com/rs/zerolog"
- "golang.org/x/exp/event/adapter/eventtest"
- "golang.org/x/exp/event/bench"
+ "golang.org/x/exp/event/eventtest"
)
var (
- zerologMsg = bench.Hooks{
+ zerologMsg = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- zerolog.Ctx(ctx).Info().Int(bench.A.Name, a).Msg(bench.A.Msg)
+ zerolog.Ctx(ctx).Info().Int(eventtest.A.Name, a).Msg(eventtest.A.Msg)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- zerolog.Ctx(ctx).Info().Str(bench.B.Name, b).Msg(bench.B.Msg)
+ zerolog.Ctx(ctx).Info().Str(eventtest.B.Name, b).Msg(eventtest.B.Msg)
return ctx
},
BEnd: func(ctx context.Context) {},
}
- zerologMsgf = bench.Hooks{
+ zerologMsgf = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- zerolog.Ctx(ctx).Info().Msgf(bench.A.Msgf, a)
+ zerolog.Ctx(ctx).Info().Msgf(eventtest.A.Msgf, a)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- zerolog.Ctx(ctx).Info().Msgf(bench.B.Msgf, b)
+ zerolog.Ctx(ctx).Info().Msgf(eventtest.B.Msgf, b)
return ctx
},
BEnd: func(ctx context.Context) {},
@@ -43,22 +42,22 @@
)
func zerologPrint(w io.Writer) context.Context {
- zerolog.TimeFieldFormat = bench.TimeFormat
+ zerolog.TimeFieldFormat = eventtest.TimeFormat
zerolog.TimestampFunc = eventtest.ExporterOptions().Now
logger := zerolog.New(zerolog.SyncWriter(w)).With().Timestamp().Logger()
return logger.WithContext(context.Background())
}
func BenchmarkZerologLogDiscard(b *testing.B) {
- bench.RunBenchmark(b, zerologPrint(io.Discard), zerologMsg)
+ eventtest.RunBenchmark(b, zerologPrint(io.Discard), zerologMsg)
}
func BenchmarkZerologLogfDiscard(b *testing.B) {
- bench.RunBenchmark(b, zerologPrint(io.Discard), zerologMsgf)
+ eventtest.RunBenchmark(b, zerologPrint(io.Discard), zerologMsgf)
}
func TestLogZerologf(t *testing.T) {
- bench.TestBenchmark(t, zerologPrint, zerologMsgf, `
+ eventtest.TestBenchmark(t, zerologPrint, zerologMsgf, `
{"level":"info","time":"2020/03/05 14:27:48","message":"a where A=0"}
{"level":"info","time":"2020/03/05 14:27:49","message":"b where B=\"A value\""}
{"level":"info","time":"2020/03/05 14:27:50","message":"a where A=1"}
diff --git a/event/alloc_test.go b/event/alloc_test.go
index 64124f3..f7a80d8 100644
--- a/event/alloc_test.go
+++ b/event/alloc_test.go
@@ -13,7 +13,7 @@
"golang.org/x/exp/event"
"golang.org/x/exp/event/adapter/logfmt"
- "golang.org/x/exp/event/bench"
+ "golang.org/x/exp/event/eventtest"
)
func TestAllocs(t *testing.T) {
@@ -31,5 +31,5 @@
}
func TestBenchAllocs(t *testing.T) {
- bench.TestAllocs(t, eventPrint, eventLog, 0)
+ eventtest.TestAllocs(t, eventPrint, eventLog, 0)
}
diff --git a/event/bench_test.go b/event/bench_test.go
index 5c00395..9dc3af6 100644
--- a/event/bench_test.go
+++ b/event/bench_test.go
@@ -10,50 +10,49 @@
"testing"
"golang.org/x/exp/event"
- "golang.org/x/exp/event/adapter/eventtest"
"golang.org/x/exp/event/adapter/logfmt"
- "golang.org/x/exp/event/bench"
+ "golang.org/x/exp/event/eventtest"
"golang.org/x/exp/event/keys"
"golang.org/x/exp/event/severity"
)
var (
- aValue = keys.Int(bench.A.Name)
- bValue = keys.String(bench.B.Name)
+ aValue = keys.Int(eventtest.A.Name)
+ bValue = keys.String(eventtest.B.Name)
aCount = keys.Int64("aCount")
aStat = keys.Int("aValue")
bCount = keys.Int64("B")
bLength = keys.Int("BLen")
- eventLog = bench.Hooks{
+ eventLog = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- event.To(ctx).With(severity.Info).With(aValue.Of(a)).Log(bench.A.Msg)
+ event.To(ctx).With(severity.Info).With(aValue.Of(a)).Log(eventtest.A.Msg)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- event.To(ctx).With(severity.Info).With(bValue.Of(b)).Log(bench.B.Msg)
+ event.To(ctx).With(severity.Info).With(bValue.Of(b)).Log(eventtest.B.Msg)
return ctx
},
BEnd: func(ctx context.Context) {},
}
- eventLogf = bench.Hooks{
+ eventLogf = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- event.To(ctx).With(severity.Info).Logf(bench.A.Msgf, a)
+ event.To(ctx).With(severity.Info).Logf(eventtest.A.Msgf, a)
return ctx
},
AEnd: func(ctx context.Context) {},
BStart: func(ctx context.Context, b string) context.Context {
- event.To(ctx).With(severity.Info).Logf(bench.B.Msgf, b)
+ event.To(ctx).With(severity.Info).Logf(eventtest.B.Msgf, b)
return ctx
},
BEnd: func(ctx context.Context) {},
}
- eventTrace = bench.Hooks{
+ eventTrace = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
- ctx, _ = event.To(ctx).Start(bench.A.Msg)
+ ctx, _ = event.To(ctx).Start(eventtest.A.Msg)
event.To(ctx).With(aValue.Of(a)).Annotate()
return ctx
},
@@ -61,7 +60,7 @@
event.To(ctx).End()
},
BStart: func(ctx context.Context, b string) context.Context {
- ctx, _ = event.To(ctx).Start(bench.B.Msg)
+ ctx, _ = event.To(ctx).Start(eventtest.B.Msg)
event.To(ctx).With(bValue.Of(b)).Annotate()
return ctx
},
@@ -70,7 +69,7 @@
},
}
- eventMetric = bench.Hooks{
+ eventMetric = eventtest.Hooks{
AStart: func(ctx context.Context, a int) context.Context {
event.To(ctx).With(aStat.Of(a)).Metric(gauge.Record(1))
event.To(ctx).With(aCount.Of(1)).Metric(gauge.Record(1))
@@ -99,33 +98,33 @@
}
func BenchmarkEventLogNoExporter(b *testing.B) {
- bench.RunBenchmark(b, eventNoExporter(), eventLog)
+ eventtest.RunBenchmark(b, eventNoExporter(), eventLog)
}
func BenchmarkEventLogNoop(b *testing.B) {
- bench.RunBenchmark(b, eventNoop(), eventLog)
+ eventtest.RunBenchmark(b, eventNoop(), eventLog)
}
func BenchmarkEventLogDiscard(b *testing.B) {
- bench.RunBenchmark(b, eventPrint(io.Discard), eventLog)
+ eventtest.RunBenchmark(b, eventPrint(io.Discard), eventLog)
}
func BenchmarkEventLogfDiscard(b *testing.B) {
- bench.RunBenchmark(b, eventPrint(io.Discard), eventLogf)
+ eventtest.RunBenchmark(b, eventPrint(io.Discard), eventLogf)
}
func BenchmarkEventTraceNoop(b *testing.B) {
- bench.RunBenchmark(b, eventNoop(), eventTrace)
+ eventtest.RunBenchmark(b, eventNoop(), eventTrace)
}
func BenchmarkEventTraceDiscard(b *testing.B) {
- bench.RunBenchmark(b, eventPrint(io.Discard), eventTrace)
+ eventtest.RunBenchmark(b, eventPrint(io.Discard), eventTrace)
}
func BenchmarkEventMetricNoop(b *testing.B) {
- bench.RunBenchmark(b, eventNoop(), eventMetric)
+ eventtest.RunBenchmark(b, eventNoop(), eventMetric)
}
func BenchmarkEventMetricDiscard(b *testing.B) {
- bench.RunBenchmark(b, eventPrint(io.Discard), eventMetric)
+ eventtest.RunBenchmark(b, eventPrint(io.Discard), eventMetric)
}
diff --git a/event/common_test.go b/event/common_test.go
index c175dae..b561ae3 100644
--- a/event/common_test.go
+++ b/event/common_test.go
@@ -10,7 +10,7 @@
"testing"
"golang.org/x/exp/event"
- "golang.org/x/exp/event/adapter/eventtest"
+ "golang.org/x/exp/event/eventtest"
)
func TestCommon(t *testing.T) {
diff --git a/event/event_test.go b/event/event_test.go
index ca1ffb0..54158a6 100644
--- a/event/event_test.go
+++ b/event/event_test.go
@@ -14,9 +14,8 @@
"time"
"golang.org/x/exp/event"
- "golang.org/x/exp/event/adapter/eventtest"
"golang.org/x/exp/event/adapter/logfmt"
- "golang.org/x/exp/event/bench"
+ "golang.org/x/exp/event/eventtest"
"golang.org/x/exp/event/keys"
)
@@ -129,9 +128,9 @@
}
func TestLogEventf(t *testing.T) {
- bench.TestBenchmark(t, eventPrint, eventLogf, bench.LogfOutput)
+ eventtest.TestBenchmark(t, eventPrint, eventLogf, eventtest.LogfOutput)
}
func TestLogEvent(t *testing.T) {
- bench.TestBenchmark(t, eventPrint, eventLog, bench.LogfmtOutput)
+ eventtest.TestBenchmark(t, eventPrint, eventLog, eventtest.LogfmtOutput)
}
diff --git a/event/bench/bench.go b/event/eventtest/bench.go
similarity index 99%
rename from event/bench/bench.go
rename to event/eventtest/bench.go
index b5151d7..0fb7189 100644
--- a/event/bench/bench.go
+++ b/event/eventtest/bench.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package bench
+package eventtest
import (
"context"
diff --git a/event/adapter/eventtest/capture.go b/event/eventtest/capture.go
similarity index 100%
rename from event/adapter/eventtest/capture.go
rename to event/eventtest/capture.go
diff --git a/event/adapter/eventtest/eventtest.go b/event/eventtest/eventtest.go
similarity index 100%
rename from event/adapter/eventtest/eventtest.go
rename to event/eventtest/eventtest.go
diff --git a/event/severity/severity_test.go b/event/severity/severity_test.go
index 44a94ee..f115052 100644
--- a/event/severity/severity_test.go
+++ b/event/severity/severity_test.go
@@ -12,8 +12,8 @@
"testing"
"golang.org/x/exp/event"
- "golang.org/x/exp/event/adapter/eventtest"
"golang.org/x/exp/event/adapter/logfmt"
+ "golang.org/x/exp/event/eventtest"
"golang.org/x/exp/event/severity"
)
diff --git a/jsonrpc2/jsonrpc2_test.go b/jsonrpc2/jsonrpc2_test.go
index e0ffe97..63cd6cc 100644
--- a/jsonrpc2/jsonrpc2_test.go
+++ b/jsonrpc2/jsonrpc2_test.go
@@ -13,7 +13,7 @@
"testing"
"time"
- "golang.org/x/exp/event/adapter/eventtest"
+ "golang.org/x/exp/event/eventtest"
"golang.org/x/exp/internal/stack/stacktest"
"golang.org/x/exp/jsonrpc2"
errors "golang.org/x/xerrors"