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

testing: examples should run in source order #4662

Closed
rsc opened this issue Jan 15, 2013 · 8 comments
Closed

testing: examples should run in source order #4662

rsc opened this issue Jan 15, 2013 · 8 comments
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jan 15, 2013

Example tests should run in the same order they appear in the source file, just as with
ordinary tests.
It appears that non-method examples are run before method examples.
@rsc
Copy link
Contributor Author

rsc commented Jan 15, 2013

Comment 1:

Also method examples are run in order sorted by method name, not source order.

@gopherbot
Copy link

Comment 2 by osaingre:

> Also method examples are run in order sorted by method name, not source order.
Hi, do you deem acceptable to remove the sort done in go.doc.Examples() ?
After all, the order is not specified in the documentation.

@rsc
Copy link
Contributor Author

rsc commented Jan 18, 2013

Comment 3:

Sorted by name is probably correct most of the time. However, it's not in this case. I
would suggest adding a new field 
Order int // original source order
to the Example struct and let cmd/go sort by that.

@gopherbot
Copy link

Comment 4 by vegacom:

since the sorting is done in example.go and not in test.go, I think removing the sort
import and related code does the trick. https://golang.org/cl/7127064
unless I'm missing something...

@rsc
Copy link
Contributor Author

rsc commented Jan 22, 2013

Comment 5:

The sorting is done in package example. That can be used for things besides generating
tests. I don't want to remove the "sorted order" guarantee that it currently makes. I
just want to make it possible to reconstruct the original order.

@gopherbot
Copy link

Comment 6 by osaingre:

Alright. I get it.

@gopherbot
Copy link

Comment 7 by vegacom:

got it, dropped CL.

@rsc
Copy link
Contributor Author

rsc commented Feb 2, 2013

Comment 8:

This issue was closed by revision 18178fd.

Status changed to Fixed.

@rsc rsc added fixed Suggested Issues that may be good for new contributors looking for work to do. labels Feb 2, 2013
@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

2 participants