Skip to content

Commit

Permalink
omnisharp-unit-test-actions.el: add omnisharp-unit-test-last
Browse files Browse the repository at this point in the history
this will run the previous-run tests again
  • Loading branch information
razzmatazz committed Dec 6, 2018
1 parent 35d21df commit 5345556
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion omnisharp-server-management.el
Expand Up @@ -27,6 +27,7 @@
;; :started? - t if server reported it has started OK and is ready
;; :project-path - path to server project .sln, .csproj or directory
;; :project-root - project root directory (based on project-path)
;; :last-unit-test - a tuple of (test-framework (test-method-names ..))
(defvar omnisharp--server-info nil)

(defvar omnisharp--last-project-path nil)
Expand All @@ -42,7 +43,8 @@
(:response-handlers . nil)
(:started? . nil)
(:project-path . ,project-path)
(:project-root . ,project-root))))
(:project-root . ,project-root)
(:last-unit-test . nil))))

(defun omnisharp--resolve-omnisharp-server-executable-path ()
"Attempts to resolve a path to local executable for the omnisharp-roslyn server.
Expand Down
8 changes: 8 additions & 0 deletions omnisharp-unit-test-actions.el
Expand Up @@ -39,13 +39,21 @@
test-methods)))
(omnisharp--unit-test-start test-method-framework test-method-names)))))

(defun omnisharp-unit-test-last ()
"Re-runs the last unit test run (if any)."
(interactive)
(let ((last-unit-test (cdr (assoc :last-unit-test omnisharp--server-info))))
(apply 'omnisharp--unit-test-start (or last-unit-test (list nil nil)))))

(defun omnisharp--unit-test-start (test-method-framework test-method-names)
"Runs tests specified by test method name"
(if (and test-method-framework test-method-names)
(let ((request-message (-concat
(omnisharp--get-request-object)
`((TestFrameworkName . ,test-method-framework)
(MethodNames . ,test-method-names)))))
(setcdr (assoc :last-unit-test omnisharp--server-info)
(list test-method-framework test-method-names))
(omnisharp--unit-test-reset-test-results-buffer t)
(omnisharp--send-command-to-server
"/v2/runtestsinclass"
Expand Down

0 comments on commit 5345556

Please sign in to comment.