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 examples as tests #24311

Closed
ysmolski opened this issue Mar 8, 2018 · 4 comments
Closed

x/playground: support examples as tests #24311

ysmolski opened this issue Mar 8, 2018 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ysmolski
Copy link
Member

ysmolski commented Mar 8, 2018

In continuation of #6511, I would like to address supporting examples as tests. Examples should be run as tests if they have a proper name and an output specified in the comment section: https://golang.org/pkg/testing/#hdr-Examples

I have a CL almost ready. Before that I would like to address one question.

My CL has a flaw which I am not sure what to do with. If some user submits a program with example and does not import "testing" package in the code then playground does it for him. Problem arises when there is some error in the code and the error highlighter points to wrong line. It happens because we have added "testing" import and then applied format.Source(). Thus sources got transformed and the playground highlights wrong line.

screen shot 2018-03-08 at 17 34 09

Should I fix this before posting a CL?

@gopherbot gopherbot added this to the Unreleased milestone Mar 8, 2018
@gopherbot
Copy link

Change https://golang.org/cl/99595 mentions this issue: x/playground: support examples as tests

@andybons
Copy link
Member

andybons commented Mar 8, 2018

Yes I think you should fix this before proceeding with your other CL.

@andybons andybons added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 8, 2018
@ysmolski
Copy link
Member Author

ysmolski commented Mar 9, 2018

Thanks, I have fixed that and the CL is ready for your review.

@ysmolski
Copy link
Member Author

@andybons, if you got some time please review https://golang.org/cl/99595. Thanks!

@golang golang locked and limited conversation to collaborators Mar 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants