(b *testing.B)
| 186 | } |
| 187 | |
| 188 | func BenchmarkSplitUnicodePrefix(b *testing.B) { |
| 189 | re := MustCompile(`(needle)`) |
| 190 | prefix := strings.Repeat("界", 21845) |
| 191 | input := prefix + "needle尾" |
| 192 | b.ReportAllocs() |
| 193 | b.ResetTimer() |
| 194 | for i := 0; i < b.N; i++ { |
| 195 | got, err := re.Split(input, -1) |
| 196 | if err != nil || len(got) != 3 || got[0] != prefix || got[1] != "needle" || got[2] != "尾" { |
| 197 | b.Fatal(got, err) |
| 198 | } |
| 199 | } |
| 200 | } |
nothing calls this directly
no test coverage detected