Skip to content

Commit

Permalink
Add another match ranges test
Browse files Browse the repository at this point in the history
  • Loading branch information
walles committed Nov 6, 2019
1 parent ea3dcf3 commit ad4c545
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions m/matchRanges_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit ad4c545

Please sign in to comment.