diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2017-07-16 23:31:19 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-07-16 23:34:32 +0900 |
commit | 9e85cba0d06025983a1a747bfc06c9955388d9c0 (patch) | |
tree | 8fe8dc1fd62ad3ecfbfd02e440fac6cfedcd313c /src/chunklist_test.go | |
parent | 4b59ced08f1d417530a25af8fe13aa5d40579220 (diff) |
Reduce memory footprint of Item struct
Diffstat (limited to 'src/chunklist_test.go')
-rw-r--r-- | src/chunklist_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/chunklist_test.go b/src/chunklist_test.go index 983a7ed8..78468e32 100644 --- a/src/chunklist_test.go +++ b/src/chunklist_test.go @@ -12,7 +12,9 @@ func TestChunkList(t *testing.T) { sortCriteria = []criterion{byScore, byLength} cl := NewChunkList(func(s []byte, i int) Item { - return Item{text: util.ToChars(s), index: int32(i * 2)} + chars := util.ToChars(s) + chars.Index = int32(i * 2) + return Item{text: chars} }) // Snapshot @@ -41,8 +43,8 @@ func TestChunkList(t *testing.T) { if len(*chunk1) != 2 { t.Error("Snapshot should contain only two items") } - if (*chunk1)[0].text.ToString() != "hello" || (*chunk1)[0].index != 0 || - (*chunk1)[1].text.ToString() != "world" || (*chunk1)[1].index != 2 { + if (*chunk1)[0].text.ToString() != "hello" || (*chunk1)[0].Index() != 0 || + (*chunk1)[1].text.ToString() != "world" || (*chunk1)[1].Index() != 2 { t.Error("Invalid data") } if chunk1.IsFull() { |