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: support running tests #6511

Closed
josharian opened this issue Sep 30, 2013 · 11 comments
Closed

x/playground: support running tests #6511

josharian opened this issue Sep 30, 2013 · 11 comments

Comments

@josharian
Copy link
Contributor

It'd be useful if the playground could run tests -- more like `go test` instead of `go
run`.

This is possible now (http://play.golang.org/p/K0gFil6jFC), but it's clumsy and
non-obvious.

Just to get the conversation started, here's a concrete proposal:

* Tests and examples are supported, but not benchmarks. (Benchmarks are going to
unreliable anyway, right?)
* If main is not present and there is an appropriate test function (or example function
with output), then the playground executes in test mode. Otherwise, behavior is
unchanged.
* "Test mode" is equivalent to `go test -v`.
* Add text to the About page explaining how to use playground for tests.
@adg
Copy link
Contributor

adg commented Sep 30, 2013

Comment 1:

Owner changed to @adg.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added repo-main.

@josharian
Copy link
Contributor Author

Comment 5:

Labels changed: added repo-playground, removed priority-triage, repo-main.

Owner changed to @josharian.

Status changed to Started.

@gopherbot
Copy link

Comment 6:

CL https://golang.org/cl/102420043 mentions this issue.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc removed the release-none label Apr 10, 2015
@rsc rsc changed the title playground: support running tests x/playground: support running tests Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@josharian
Copy link
Contributor Author

@adg any new thoughts about this? I could bring that old CL back to life if you were interested.

@adg
Copy link
Contributor

adg commented Jun 26, 2016

If we're to do this, we could be more general: extend the API to accept multiple input files, which are built together as a package. We could even permit building a tree of packages. Then we could provide execution options (run, test, bench, others?) to run against those packages. I think the implementation of this would be pretty straightforward. The hardest part would be designing a nice JSON API for the requests.

@bradfitz
Copy link
Contributor

@adg, we could even introduce magic comments as a way to mark new files, which is common in people's bug reports anyway.

But I see no reason to tie that feature to this. They seem separable.

@gopherbot
Copy link

Change https://golang.org/cl/98155 mentions this issue: playground: support running tests

@ysmolski
Copy link
Member

ysmolski commented Mar 2, 2018

I have committed a change based mostly on the way @josharian did it 3.5 years ago. I was going different direction at first but ended with something very close to that old change by Josh. At worst it was very good learning experience for me. I would be glad of somebody gave it a proper review.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants