Files
e6399cc52d Fix panic on overlapping wildcard path patterns (#4163)
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jakebailey <[email protected]>
2026-06-03 20:00:03 +00:00

25 lines
553 B
Go

package core
import "testing"
func TestPatternOverlappingMatch(t *testing.T) {
t.Parallel()
p := TryParsePattern("ab*ab")
if p.Matches("ab") {
t.Errorf("expected 'ab' not to match 'ab*ab'")
}
if !p.Matches("abXab") {
t.Errorf("expected 'abXab' to match 'ab*ab'")
}
if got := p.MatchedText("abXab"); got != "X" {
t.Errorf("MatchedText = %q, want %q", got, "X")
}
if !p.Matches("abab") {
t.Errorf("expected 'abab' to match 'ab*ab'")
}
if got := p.MatchedText("abab"); got != "" {
t.Errorf("MatchedText = %q, want empty", got)
}
}