Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to match with non-ASCII rune at end of segment #54

Open
calmh opened this issue Jun 15, 2022 · 0 comments
Open

Fails to match with non-ASCII rune at end of segment #54

calmh opened this issue Jun 15, 2022 · 0 comments

Comments

@calmh
Copy link
Contributor

calmh commented Jun 15, 2022

When there's a non-ASCII rune adjacent to a wildcard or at the end of a pattern, the matcher fails. Adding these test cases, the marked ones fail:

		glob(true, "155ö", "155ö"),
		glob(true, "1?5ö", "155ö"), // <-
		glob(true, "1?ö5", "15ö5"),
		glob(true, "155helloö", "155helloö"),
		glob(true, "1?5helloö", "155helloö"), // <-
		glob(true, "1?ö5hello", "15ö5hello"),
		glob(true, "1?5heöllo", "155heöllo"),
		glob(true, "1ö?5", "1ö55"), // <-
		glob(true, "ö1?5", "ö155"),
calmh added a commit to calmh/glob that referenced this issue Jun 15, 2022
When matching a row we calculate an index into the string, and this
index was in runes. However when slicing the string Go uses byte
indexes. This change tracks both, using the rune count to determine the
correct length and the byte index to slice the string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant