mirror of
https://github.com/walles/moar.git
synced 2024-11-11 00:27:04 +03:00
Add another match ranges test
This commit is contained in:
parent
ea3dcf3ca5
commit
ad4c545df0
@ -63,3 +63,13 @@ func TestNoMatch(t *testing.T) {
|
||||
assert.Assert(t, !matchRanges.InRange(3))
|
||||
assert.Assert(t, !matchRanges.InRange(4))
|
||||
}
|
||||
|
||||
func TestEndMatch(t *testing.T) {
|
||||
// This test verifies that the match ranges are by rune rather than by byte
|
||||
unicodes := "-ä"
|
||||
matchRanges := GetMatchRanges(&unicodes, regexp.MustCompile("ä"))
|
||||
|
||||
assert.Assert(t, !matchRanges.InRange(0)) // -
|
||||
assert.Assert(t, matchRanges.InRange(1)) // ä
|
||||
assert.Assert(t, !matchRanges.InRange(2)) // Past the end
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user