Skip to content

Commit 326a1e3

Browse files
committed
add test to reach 100% code coverage
1 parent e452657 commit 326a1e3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

varint_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ func TestVarInt(t *testing.T) {
2424
}
2525
}
2626

27+
func TestTruncated(t *testing.T) {
28+
var buf []byte
29+
if l := Encode(buf, 1234); l != 0 {
30+
t.Fatalf("expected 0, got %d", l)
31+
}
32+
if l, v := Decode(buf); l != 0 || v != 0 {
33+
t.Fatalf("expected 0 and 0, got %d and %d", l, v)
34+
}
35+
}
36+
2737
var out int
2838
var buf0 = make([]byte, 1024)
2939
var buf = buf0[:rand.Int()%1010]

0 commit comments

Comments
 (0)