============================================================================= Correctness Tests =============================================================================
(t *testing.T)
| 29 | // ============================================================================= |
| 30 | |
| 31 | func TestGoAWK_MatchPattern(t *testing.T) { |
| 32 | // Pattern: j[a-z]+p should match "jump" in the input |
| 33 | pattern := `j[a-z]+p` |
| 34 | input := goawkMatchInput |
| 35 | |
| 36 | reCoregex := coregex.MustCompile(pattern) |
| 37 | reStdlib := regexp.MustCompile(pattern) |
| 38 | |
| 39 | // Test FindString |
| 40 | gotCoregex := reCoregex.FindString(input) |
| 41 | gotStdlib := reStdlib.FindString(input) |
| 42 | |
| 43 | if gotCoregex != gotStdlib { |
| 44 | t.Errorf("FindString mismatch: coregex=%q, stdlib=%q", gotCoregex, gotStdlib) |
| 45 | } |
| 46 | |
| 47 | // Test FindStringIndex |
| 48 | idxCoregex := reCoregex.FindStringIndex(input) |
| 49 | idxStdlib := reStdlib.FindStringIndex(input) |
| 50 | |
| 51 | if len(idxCoregex) != len(idxStdlib) { |
| 52 | t.Errorf("FindStringIndex length mismatch: coregex=%v, stdlib=%v", idxCoregex, idxStdlib) |
| 53 | } else if len(idxCoregex) == 2 { |
| 54 | if idxCoregex[0] != idxStdlib[0] || idxCoregex[1] != idxStdlib[1] { |
| 55 | t.Errorf("FindStringIndex mismatch: coregex=%v, stdlib=%v", idxCoregex, idxStdlib) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // Test MatchString |
| 60 | matchCoregex := reCoregex.MatchString(input) |
| 61 | matchStdlib := reStdlib.MatchString(input) |
| 62 | |
| 63 | if matchCoregex != matchStdlib { |
| 64 | t.Errorf("MatchString mismatch: coregex=%v, stdlib=%v", matchCoregex, matchStdlib) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | func TestGoAWK_SplitPattern(t *testing.T) { |
| 69 | // Pattern: f[a-z]x matches "fox", "fax", "fix" |
nothing calls this directly
no test coverage detected