| 1 |
[short] skip |
| 2 |
|
| 3 |
go test ./... |
| 4 |
stdout 'pkg1(.|\n)*pkg2' |
| 5 |
|
| 6 |
-- go.mod -- |
| 7 |
module m |
| 8 |
|
| 9 |
-- pkg1/x_test.go -- |
| 10 |
package pkg1 |
| 11 |
|
| 12 |
import ( |
| 13 |
"testing" |
| 14 |
"time" |
| 15 |
) |
| 16 |
|
| 17 |
func Test(t *testing.T) { |
| 18 |
// This sleep makes it more likely that pkg2 will be ready before pkg1, |
| 19 |
// which previously would have made this test fail, because pkg2 would |
| 20 |
// be printed before pkg1. |
| 21 |
// Now that there is proper ordering, the Sleep should not matter. |
| 22 |
// In particular, the Sleep does not make the test pass and won't |
| 23 |
// be a problem on slow builders. |
| 24 |
time.Sleep(1*time.Second) |
| 25 |
} |
| 26 |
-- pkg2/x.go -- |
| 27 |
package pkg2 |