Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit fd6e6a3

Browse files
committed
shed: more tests for Index.Offset (causing crash)
1 parent a96fb51 commit fd6e6a3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

shed/index_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,4 +1160,20 @@ func TestIndexOffset(t *testing.T) {
11601160
})
11611161
}
11621162

1163+
// special cases
1164+
tests = []struct {
1165+
start, offset int
1166+
}{
1167+
{0, -1},
1168+
{len(items) - 1, 1},
1169+
}
1170+
1171+
for _, tc := range tests {
1172+
t.Run(fmt.Sprintf("%d_%d", tc.start, tc.offset), func(tt *testing.T) {
1173+
_, err := index.Offset(&items[tc.start], int64(tc.offset))
1174+
if err == nil {
1175+
tt.Error("expected error")
1176+
}
1177+
})
1178+
}
11631179
}

0 commit comments

Comments
 (0)