package eventtest

import "golang.org/x/tools/internal/event/export/eventtest"

Package eventtest supports logging events to a test. You can use NewContext to create a context that knows how to deliver telemetry events back to the test. You must use this context or a derived one anywhere you want telemetry to be correctly routed back to the test it was constructed with. Any events delivered to a background context will be dropped.

Importing this package will cause it to register a new global telemetry exporter that understands the special contexts returned by NewContext. This means you should not import this package if you are not going to call NewContext.

Index

Functions

func NewContext

func NewContext(ctx context.Context, t testing.TB) context.Context

NewContext returns a context you should use for the active test.

Source Files

eventtest.go

Version
v0.30.0 (latest)
Published
Feb 10, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
8 hours ago

Tools for package owners.