37 lines
724 B
Go
37 lines
724 B
Go
package coco
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gin-gonic/gin"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
type A struct {
|
|
}
|
|
|
|
func (a *A) RetErr() error {
|
|
var err error
|
|
return err
|
|
}
|
|
|
|
func TestRegister_getCallFunc(t *testing.T) {
|
|
var a = new(A)
|
|
fvo := reflect.ValueOf(a)
|
|
ftp := fvo.Type()
|
|
ff := ftp.Method(0).Func
|
|
|
|
fret := ff.Call([]reflect.Value{fvo})
|
|
fmt.Println(fret[0].Interface() == nil)
|
|
}
|
|
|
|
func TestNewRegister(t *testing.T) {
|
|
var register = NewRegister()
|
|
register.DefaultRouter(WithListenAddress("localhost:8080"), WithGinMode(gin.ReleaseMode), WithCors(), WithRecovery())
|
|
|
|
// register.PreRun(nil)
|
|
// protoc core/file_module.proto --coco_out=core --go_out=core
|
|
//reg.RegisterStruct(AutoGenXXXRouterMap, &XXX{})
|
|
register.Run()
|
|
}
|