mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
refactor: use reflect.TypeFor instead of reflect.TypeOf and improve related tests (#2101)
* refactor: using reflect.TypeFor Signed-off-by: suranmiao <solsui@outlook.com> * refactor: remove unused reflect.TypeFor calls and improve test assertions * refactor: simplify TestSetup by removing reflect.TypeFor * test: enhance test assertions and improve parallel execution in TestSetup --------- Signed-off-by: suranmiao <solsui@outlook.com> Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
@@ -64,8 +64,7 @@ func main() {
|
||||
wg.Wait()
|
||||
log.Println("Done.")
|
||||
|
||||
var dummyInterface exchange.IBotExchange
|
||||
totalWrappers := reflect.TypeOf(&dummyInterface).Elem().NumMethod()
|
||||
totalWrappers := reflect.TypeFor[exchange.IBotExchange]().NumMethod()
|
||||
|
||||
log.Println()
|
||||
for name, funcs := range results {
|
||||
@@ -89,11 +88,11 @@ func main() {
|
||||
// error common.ErrNotYetImplemented to verify whether the wrapper function has
|
||||
// been implemented yet.
|
||||
func testWrappers(e exchange.IBotExchange) ([]string, error) {
|
||||
iExchange := reflect.TypeOf(&e).Elem()
|
||||
iExchange := reflect.TypeFor[exchange.IBotExchange]()
|
||||
actualExchange := reflect.ValueOf(e)
|
||||
errType := reflect.TypeOf(common.ErrNotYetImplemented)
|
||||
|
||||
contextParam := reflect.TypeOf((*context.Context)(nil)).Elem()
|
||||
contextParam := reflect.TypeFor[context.Context]()
|
||||
|
||||
var funcs []string
|
||||
for x := range iExchange.NumMethod() {
|
||||
|
||||
Reference in New Issue
Block a user