-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.Issues that may be good for new contributors looking for work to do.
Milestone
Description
Ideally tests should support unordered output as well as regular output in testing so that every example that uses maps doesn't need to make an output array and sort it (therefor adding complexity to unrelated example code.) This is very useful when dealing with maps which by design return unordered iteration patterns.
An example of the syntax I am proposing (Or something like that):
func Example() {
x := map[string]int{"a": 1, "b": 2, "c", 3}
for key, value := range x {
fmt.Printf("key=%s value=%d\n", key, value)
}
// Unordered output:
// key=a value=1
// key=b value=2
// key=c value=3
}
In this case the output on godoc would show the above, while the test would pass regardless of which order the lines were outputted.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.Issues that may be good for new contributors looking for work to do.