Remove Offset slice from Result struct

This commit is contained in:
Junegunn Choi
2016-08-20 01:46:54 +09:00
parent 3e88849386
commit 827a83efbc
9 changed files with 55 additions and 46 deletions

View File

@@ -135,10 +135,16 @@ func TestOrigTextAndTransformed(t *testing.T) {
pattern.extended = extended
matches := pattern.matchChunk(&chunk, nil) // No cache
if matches[0].item.text.ToString() != "junegunn" || string(*matches[0].item.origText) != "junegunn.choi" ||
matches[0].offsets[0][0] != 0 || matches[0].offsets[0][1] != 5 ||
!reflect.DeepEqual(matches[0].item.transformed, trans) {
t.Error("Invalid match result", matches)
}
match, offsets := pattern.MatchItem(chunk[0])
if match.item.text.ToString() != "junegunn" || string(*match.item.origText) != "junegunn.choi" ||
offsets[0][0] != 0 || offsets[0][1] != 5 ||
!reflect.DeepEqual(match.item.transformed, trans) {
t.Error("Invalid match result", match)
}
}
}