mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 15:11:07 +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:
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -33,16 +32,9 @@ func TestNewVM(t *testing.T) {
|
||||
manager := GctScriptManager{
|
||||
config: configHelper(true, true, maxTestVirtualMachines),
|
||||
}
|
||||
x := manager.New()
|
||||
if x != nil {
|
||||
t.Error("Should not create a VM when manager not started")
|
||||
}
|
||||
require.Nil(t, manager.New(), "New must not create a VM when manager not started")
|
||||
manager.started = 1
|
||||
x = manager.New()
|
||||
xType := reflect.TypeOf(x).String()
|
||||
if xType != "*vm.VM" {
|
||||
t.Fatalf("vm.New should return pointer to VM instead received: %v", x)
|
||||
}
|
||||
require.NotNil(t, manager.New(), "New must create a VM when manager is started")
|
||||
}
|
||||
|
||||
func TestVMLoad(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user