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

x/playground: multifile code should support tests too #32403

Open
rogpeppe opened this issue Jun 3, 2019 · 3 comments
Open

x/playground: multifile code should support tests too #32403

rogpeppe opened this issue Jun 3, 2019 · 3 comments

Comments

@rogpeppe
Copy link
Contributor

@rogpeppe rogpeppe commented Jun 3, 2019

The playground docs say:

If the program contains tests or examples and no main function, the service runs the tests.

This example contains tests and no main function, but it doesn't work. Looks like that's because it also contains other files.

https://play.golang.org/p/eYjtKS7J25y

I'd expect the example to run TestFoo as a test.

@bcmills bcmills changed the title playground: multifile code should support tests too x/playground: multifile code should support tests too Jun 3, 2019
@gopherbot gopherbot added this to the Unreleased milestone Jun 3, 2019
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Jun 3, 2019

For an even smaller repro, compare:

https://play.golang.org/p/t-tmCBPADwt compiles and runs.

https://play.golang.org/p/PkTK3_aY7L8, which adds only a go.mod file, fails:

# example.com
runtime.main_main·f: function main is undeclared in the main package

Go build failed.
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Jun 3, 2019

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Jun 3, 2019

This support would be really useful for go test reports like the one in #32379.

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