Skip to content

Commit

Permalink
Enabled case-selection when debugging a test in vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaumgarten committed Dec 8, 2020
1 parent e056f0a commit 68952e6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func load(args []string) {
} else {
helper, err = debug.FromScripts("", args, prepareVM)
}
helper.IgnoreErrs = ignoreErrs
exitOnError(err, "starting debugger")
helper.IgnoreErrs = ignoreErrs

debugShell.Println("Loaded and paused programs. Enter 'c' to start execution.")
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/debug/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ func (h *YODKHandler) helperFromArguments(arguments map[string]interface{}) (*He

} else if testfield, exists := arguments["test"]; exists {
tcase := 1
if casefield, exists := arguments["testcase"]; exists {
if casefield, exists := arguments["testCase"]; exists {
if casenr, is := casefield.(int); is {
tcase = casenr
}
if casenr, is := casefield.(float64); is {
tcase = int(casenr)
}
}
if test, is := testfield.(string); is {
return FromTest(ws, test, tcase, h.configureVM)
Expand Down
4 changes: 4 additions & 0 deletions pkg/debug/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ func FromTest(workspace string, testfile string, casenr int, prepareVM VMPrepare
}
}

if casenr < 1 || casenr > len(t.Cases) {
return nil, fmt.Errorf("The test-file does not contain a case number %d!", casenr)
}

runner, err := t.GetRunner(casenr - 1)
if err != nil {
return nil, err
Expand Down
5 changes: 5 additions & 0 deletions vscode-yolol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@
"description": "Path to a yodk-test-file to debug",
"default": ""
},
"testCase": {
"type": "number",
"desciption": "The number of the test-case drom the test.yaml to run",
"default": 1
},
"workspace": {
"type": "string",
"description": "A folder to which file-paths are relative"
Expand Down

0 comments on commit 68952e6

Please sign in to comment.