40 lines
699 B
Go
40 lines
699 B
Go
package core
|
|
|
|
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 reg = NewRegister()
|
|
reg.DefaultRouter(WithGinMode(gin.DebugMode))
|
|
if err := reg.PreRun(func() error {
|
|
return nil
|
|
}); err != nil {
|
|
// todo
|
|
}
|
|
// protoc core/file_module.proto --coco_out=core --go_out=core
|
|
//reg.RegisterStruct(AutoGenFileRouterMap, &File{})
|
|
reg.Run()
|
|
}
|