mirror of https://github.com/gin-gonic/gin.git
chore: add test case for source/function of recovery.go (#1467)
This commit is contained in:
parent
9666ba6738
commit
1f1bc429ed
|
@ -41,3 +41,23 @@ func TestPanicWithAbort(t *testing.T) {
|
|||
// TEST
|
||||
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)
|
||||
}
|
||||
|
||||
func TestFunction(t *testing.T) {
|
||||
bs := function(1)
|
||||
assert.Equal(t, []byte("???"), bs)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue