1
1
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:
Johan Walles 2019-11-06 21:40:14 +01:00
parent ea3dcf3ca5
commit ad4c545df0

View File

@ -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
}