From 5345556ed76f17835d2034c53d01d6b342b991a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saulius=20Menkevi=C4=8Dius?= Date: Thu, 6 Dec 2018 01:16:04 +0100 Subject: [PATCH] omnisharp-unit-test-actions.el: add omnisharp-unit-test-last this will run the previous-run tests again --- omnisharp-server-management.el | 4 +++- omnisharp-unit-test-actions.el | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/omnisharp-server-management.el b/omnisharp-server-management.el index 034c0995..299a67f2 100644 --- a/omnisharp-server-management.el +++ b/omnisharp-server-management.el @@ -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) @@ -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. diff --git a/omnisharp-unit-test-actions.el b/omnisharp-unit-test-actions.el index 8d046d89..b9dd39b5 100644 --- a/omnisharp-unit-test-actions.el +++ b/omnisharp-unit-test-actions.el @@ -39,6 +39,12 @@ 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) @@ -46,6 +52,8 @@ (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"