-
Notifications
You must be signed in to change notification settings - Fork 13
/
fastapi_test.go
46 lines (38 loc) · 1.32 KB
/
fastapi_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package fastapi
import (
"github.com/gin-gonic/gin"
"testing"
)
func TestInvalidHandler1(t *testing.T) {
defer func() { recover() }()
NewRouter().AddCall("x", func(in struct{}) (out struct{}) { return })
t.Errorf("Did not panic")
}
func TestInvalidHandler2(t *testing.T) {
defer func() { recover() }()
NewRouter().AddCall("x", func(ctx *gin.Context, in struct{}) (out struct{}) { return })
t.Errorf("Did not panic")
}
func TestInvalidHandler3(t *testing.T) {
defer func() { recover() }()
NewRouter().AddCall("x", func(in struct{}) (out struct{}, err error) { return })
t.Errorf("Did not panic")
}
func TestInvalidHandler4(t *testing.T) {
defer func() { recover() }()
NewRouter().AddCall("x", func(ctx struct{}, in struct{}) (out struct{}, err error) { return })
t.Errorf("Did not panic")
}
func TestInvalidHandler5(t *testing.T) {
defer func() { recover() }()
NewRouter().AddCall("x", func(ctx *gin.Context, in string) (out struct{}, err error) { return })
t.Errorf("Did not panic")
}
func TestInvalidHandler6(t *testing.T) {
defer func() { recover() }()
NewRouter().AddCall("x", func(ctx *gin.Context, in struct{}) (out string, err error) { return })
t.Errorf("Did not panic")
}
func TestCorrectHandler(t *testing.T) {
NewRouter().AddCall("x", func(ctx *gin.Context, in struct{}) (out struct{}, err error) { return })
}