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 (
|
const (
|
||||||
vmExecute vmUTActionType = "Execute"
|
vmExecute vmUTActionType = "execute"
|
||||||
vmStepInto vmUTActionType = "StepInto"
|
vmStepInto vmUTActionType = "stepinto"
|
||||||
vmStepOut vmUTActionType = "StepOut"
|
vmStepOut vmUTActionType = "stepout"
|
||||||
vmStepOver vmUTActionType = "StepOver"
|
vmStepOver vmUTActionType = "stepover"
|
||||||
|
|
||||||
typeArray vmUTStackItemType = "array"
|
typeArray vmUTStackItemType = "array"
|
||||||
typeBoolean vmUTStackItemType = "boolean"
|
typeBoolean vmUTStackItemType = "boolean"
|
||||||
|
@ -271,7 +271,7 @@ func (v *vmUTStackItem) toStackItem() StackItem {
|
||||||
func execStep(t *testing.T, v *VM, step vmUTStep) {
|
func execStep(t *testing.T, v *VM, step vmUTStep) {
|
||||||
for i, a := range step.Actions {
|
for i, a := range step.Actions {
|
||||||
var err error
|
var err error
|
||||||
switch a {
|
switch a.toLower() {
|
||||||
case vmExecute:
|
case vmExecute:
|
||||||
err = v.Run()
|
err = v.Run()
|
||||||
case vmStepInto:
|
case vmStepInto:
|
||||||
|
@ -338,6 +338,10 @@ func decodeSingle(s string) ([]byte, bool) {
|
||||||
return b, err == nil
|
return b, err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v vmUTActionType) toLower() vmUTActionType {
|
||||||
|
return vmUTActionType(strings.ToLower(string(v)))
|
||||||
|
}
|
||||||
|
|
||||||
func (v *vmUTActionType) UnmarshalJSON(data []byte) error {
|
func (v *vmUTActionType) UnmarshalJSON(data []byte) error {
|
||||||
return json.Unmarshal(data, (*string)(v))
|
return json.Unmarshal(data, (*string)(v))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue