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

Comments

Projects
None yet
2 participants
@rsc
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2013

Comment 1:

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

This comment has been minimized.

Copy link

commented Jan 15, 2013

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

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link

commented Jan 20, 2013

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

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link

commented Jan 23, 2013

Comment 6 by osaingre:

Alright. I get it.
@gopherbot

This comment has been minimized.

Copy link

commented Jan 27, 2013

Comment 7 by vegacom:

got it, dropped CL.
@rsc

This comment has been minimized.

Copy link
Contributor Author

commented Feb 2, 2013

Comment 8:

This issue was closed by revision 18178fd.

Status changed to Fixed.

@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.
You can’t perform that action at this time.