mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 18:22:23 +08:00
add test case for source
This commit is contained in:
parent
9666ba6738
commit
d1db18da52
@ -41,3 +41,18 @@ func TestPanicWithAbort(t *testing.T) {
|
|||||||
// TEST
|
// TEST
|
||||||
assert.Equal(t, 400, w.Code)
|
assert.Equal(t, 400, w.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSource(t *testing.T) {
|
||||||
|
bs := source(nil, 0)
|
||||||
|
assert.Equal(t, []byte("???"), bs)
|
||||||
|
|
||||||
|
in := [][]byte{
|
||||||
|
[]byte("Hello world."),
|
||||||
|
[]byte("Hi, gin.."),
|
||||||
|
}
|
||||||
|
bs = source(in, 10)
|
||||||
|
assert.Equal(t, []byte("???"), bs)
|
||||||
|
|
||||||
|
bs = source(in, 1)
|
||||||
|
assert.Equal(t, []byte("Hello world."), bs)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user