"go test" does not assure tests are run in definition order. If the
current "go test" does that, it is not part of the specification and could
change at any time.
Sorting by address is not guaranteed to get you definition order either.
(Again, it may in some Go versions, but is not guaranteed by the spec.)
In fact, now that I think about it I'm not sure how "go test" ends up
running them in definition order. Weird.
Tests in general should not depend on the order in which they are executed.
If they do, the tests are not independent and I would consider that a bug
in itself. Of course, as the writer of a testing package you're at the
mercy of the quality of the tests that your users write. But if the test
order breaks their tests, I would report that to your user, not try to fix
On Friday, January 1, 2016 at 7:09:50 PM UTC-8, Lee Benson wrote:
I'm working with a test/assertion package that runs on top of `go test`.
Like go test, I'd like to assure tests are run per definition order. Right
now they're being reflected via their index value, and thus alphabetised.
This is messing up test order and breaking stuff.
Is checking the pointer address and sorting by uintptr guaranteed to
produce definition order?
Or is it possible that Go could allocate space non-linearly?
Thanks in advance - and happy New Year guys.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.