synctest/synctest.go

go · src/testing/synctest/synctest.go · go · BSD-3-Clause
testing, tag:embed-classified

Provides a test bubble that isolates goroutines and fake time for concurrent test isolation.

// Source: https://github.com/golang/go | License: BSD-3-Clause | Copyright 2009 The Go Authors
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package synctest provides support for testing concurrent code.
//
// The [Test] function runs a function in an isolated "bubble".
// Any goroutines started within the bubble are also part of the bubble.
//
// Each test should be entirely self-contained:
// The following guidelines should apply to most tests:
//
//   - Avoid interacting with goroutines not started from within the test.
//   - Avoid using the network. Use a fake network implementation as needed.
//   - Avoi

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key