forked from TrueCloudLab/neoneo-go
vm/tests: unmarshal action in JSON tests properly
This commit is contained in:
parent
7ddb23abe3
commit
128a99dec2
1 changed files with 9 additions and 5 deletions
|
@ -73,10 +73,10 @@ type stackItemAUX struct {
|
|||
}
|
||||
|
||||
const (
|
||||
vmExecute vmUTActionType = "Execute"
|
||||
vmStepInto vmUTActionType = "StepInto"
|
||||
vmStepOut vmUTActionType = "StepOut"
|
||||
vmStepOver vmUTActionType = "StepOver"
|
||||
vmExecute vmUTActionType = "execute"
|
||||
vmStepInto vmUTActionType = "stepinto"
|
||||
vmStepOut vmUTActionType = "stepout"
|
||||
vmStepOver vmUTActionType = "stepover"
|
||||
|
||||
typeArray vmUTStackItemType = "array"
|
||||
typeBoolean vmUTStackItemType = "boolean"
|
||||
|
@ -271,7 +271,7 @@ func (v *vmUTStackItem) toStackItem() StackItem {
|
|||
func execStep(t *testing.T, v *VM, step vmUTStep) {
|
||||
for i, a := range step.Actions {
|
||||
var err error
|
||||
switch a {
|
||||
switch a.toLower() {
|
||||
case vmExecute:
|
||||
err = v.Run()
|
||||
case vmStepInto:
|
||||
|
@ -338,6 +338,10 @@ func decodeSingle(s string) ([]byte, bool) {
|
|||
return b, err == nil
|
||||
}
|
||||
|
||||
func (v vmUTActionType) toLower() vmUTActionType {
|
||||
return vmUTActionType(strings.ToLower(string(v)))
|
||||
}
|
||||
|
||||
func (v *vmUTActionType) UnmarshalJSON(data []byte) error {
|
||||
return json.Unmarshal(data, (*string)(v))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue