Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: testing: add Test function #32067

rogpeppe opened this issue May 15, 2019 · 1 comment


None yet
3 participants
Copy link

commented May 15, 2019

The testing package has long contained the Benchmark function, which allows code in a non-testing source file to run benchmarks.

It is sometimes useful to be able to run test code in a non-testing context too; for example to demonstrate a failing test in the Go playground.

Perhaps something like this?

// Test runs f as a test with the given name. Any test output
// is written to w. Test reports whether the test has succeeded.
func Test(w io.Writer, name string, f func(t *testing.T)) bool

@gopherbot gopherbot added this to the Proposal milestone May 15, 2019

@gopherbot gopherbot added the Proposal label May 15, 2019


This comment has been minimized.

Copy link

commented May 15, 2019

See also #6511

There is work in progress now to allow multiple files in the playground, which should make this better yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.