MCPcopy Create free account
hub / github.com/coregx/coregex / TestStdlibCompat_FindAll

Function TestStdlibCompat_FindAll

stdlib_compat_test.go:365–388  ·  view source on GitHub ↗

=========================================================================== FindAll Tests - Compare coregex vs stdlib ===========================================================================

(t *testing.T)

Source from the content-addressed store, hash-verified

363// ===========================================================================
364
365func TestStdlibCompat_FindAll(t *testing.T) {
366 for _, test := range findTests {
367 t.Run(test.String(), func(t *testing.T) {
368 stdRe := regexp.MustCompile(test.pat)
369 cgRe := MustCompile(test.pat)
370
371 stdResult := stdRe.FindAll([]byte(test.text), -1)
372 cgResult := cgRe.FindAll([]byte(test.text), -1)
373
374 if len(stdResult) != len(cgResult) {
375 t.Errorf("FindAll(%q, %q) count mismatch:\n stdlib: %d\n coregex: %d",
376 test.pat, test.text, len(stdResult), len(cgResult))
377 return
378 }
379
380 for i := range stdResult {
381 if !reflect.DeepEqual(stdResult[i], cgResult[i]) {
382 t.Errorf("FindAll(%q, %q)[%d]:\n stdlib: %q\n coregex: %q",
383 test.pat, test.text, i, stdResult[i], cgResult[i])
384 }
385 }
386 })
387 }
388}
389
390func TestStdlibCompat_FindAllString(t *testing.T) {
391 for _, test := range findTests {

Callers

nothing calls this directly

Calls 3

MustCompileFunction · 0.85
FindAllMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected