(t *testing.T, n int, arg interface{}, format, want string)
| 385 | } |
| 386 | |
| 387 | func testFormatRegexp(t *testing.T, n int, arg interface{}, format, want string) { |
| 388 | t.Helper() |
| 389 | got := fmt.Sprintf(format, arg) |
| 390 | gotLines := strings.SplitN(got, "\n", -1) |
| 391 | wantLines := strings.SplitN(want, "\n", -1) |
| 392 | |
| 393 | if len(wantLines) > len(gotLines) { |
| 394 | t.Errorf("test %d: wantLines(%d) > gotLines(%d):\n got: %q\nwant: %q", n+1, len(wantLines), len(gotLines), got, want) |
| 395 | return |
| 396 | } |
| 397 | |
| 398 | for i, w := range wantLines { |
| 399 | match, err := regexp.MatchString(w, gotLines[i]) |
| 400 | if err != nil { |
| 401 | t.Fatal(err) |
| 402 | } |
| 403 | if !match { |
| 404 | t.Errorf("test %d: line %d: fmt.Sprintf(%q, err):\n got: %q\nwant: %q", n+1, i+1, format, got, want) |
| 405 | } |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | var stackLineR = regexp.MustCompile(`\.`) |
| 410 |
no outgoing calls
no test coverage detected
searching dependent graphs…