mirror of https://github.com/golang/go.git
Tests in package context cannot depend directly on package testing due to an import cycle. We resolved this by having test functions in package context_test (x_test.go) forward to test functions in package context (context_test.go). This is fragile, since it's easy to add a test to context_test.go and forget to add the forwarding function, and tests written in this way cannot easily use testing package features like t.Run for subtests. It turns out that only four test functions actually use unexported members of package context. This CL moves all except those four to x_test.go and makes them regular tests. It also updates TestCause to use t.Run and t.Parallel to parallelize its test cases. It also adds documentation indicating when tests should be added to each file. Change-Id: Ic60bae32a7a44e07831b5388c9af219d53ba9af3 Reviewed-on: https://go-review.googlesource.com/c/go/+/480375 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Sameer Ajmani <sameer@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com> |
||
|---|---|---|
| .. | ||
| benchmark_test.go | ||
| context.go | ||
| context_test.go | ||
| example_test.go | ||
| net_test.go | ||
| x_test.go | ||