summaryrefslogtreecommitdiffstats
path: root/src/chunklist_test.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-07-16 23:31:19 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-07-16 23:34:32 +0900
commit9e85cba0d06025983a1a747bfc06c9955388d9c0 (patch)
tree8fe8dc1fd62ad3ecfbfd02e440fac6cfedcd313c /src/chunklist_test.go
parent4b59ced08f1d417530a25af8fe13aa5d40579220 (diff)
Reduce memory footprint of Item struct
Diffstat (limited to 'src/chunklist_test.go')
-rw-r--r--src/chunklist_test.go8
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() {