From 0d171ba1d81886c6f9caf61867129e6daa268cd6 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 15 Aug 2017 01:10:41 +0900 Subject: Remove special nilItem --- src/pattern_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/pattern_test.go') diff --git a/src/pattern_test.go b/src/pattern_test.go index 4066eb4d..54d6f512 100644 --- a/src/pattern_test.go +++ b/src/pattern_test.go @@ -130,12 +130,11 @@ func TestOrigTextAndTransformed(t *testing.T) { origBytes := []byte("junegunn.choi") for _, extended := range []bool{false, true} { - chunk := Chunk{ - Item{ - text: util.ToChars([]byte("junegunn")), - origText: &origBytes, - transformed: &trans}, - } + chunk := Chunk{count: 1} + chunk.items[0] = Item{ + text: util.ToChars([]byte("junegunn")), + origText: &origBytes, + transformed: &trans} pattern.extended = extended matches := pattern.matchChunk(&chunk, nil, slab) // No cache if !(matches[0].item.text.ToString() == "junegunn" && @@ -144,7 +143,7 @@ func TestOrigTextAndTransformed(t *testing.T) { t.Error("Invalid match result", matches) } - match, offsets, pos := pattern.MatchItem(&chunk[0], true, slab) + match, offsets, pos := pattern.MatchItem(&chunk.items[0], true, slab) if !(match.item.text.ToString() == "junegunn" && string(*match.item.origText) == "junegunn.choi" && offsets[0][0] == 0 && offsets[0][1] == 5 && -- cgit v1.2.3