diff options
author | oreodave <aryadevchavali1@gmail.com> | 2019-08-27 17:24:27 +0100 |
---|---|---|
committer | oreodave <aryadevchavali1@gmail.com> | 2019-08-27 17:24:27 +0100 |
commit | fc86026dcd00cf035bf5344f6175eb43917771cb (patch) | |
tree | 32de6c586c7d2b3347c75899f5d381c911fe2000 /doom.d | |
parent | 38c273a5d9a5f83ece316299654fe15b73520f70 (diff) | |
download | dotfiles-fc86026dcd00cf035bf5344f6175eb43917771cb.tar.gz dotfiles-fc86026dcd00cf035bf5344f6175eb43917771cb.tar.bz2 dotfiles-fc86026dcd00cf035bf5344f6175eb43917771cb.zip |
-csharp-unit-test function +reimpl of emit-results
The reimplementation of omnisharp--unit-test-emit-results is so stdout
is always printed regardless of errors. Makes it cleaner to use.
Diffstat (limited to 'doom.d')
-rw-r--r-- | doom.d/config.org | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/doom.d/config.org b/doom.d/config.org index f847370..b9fe3ca 100644 --- a/doom.d/config.org +++ b/doom.d/config.org @@ -169,12 +169,61 @@ My docsets are stored in .docsets for ease of use (load-file (concat doom-private-dir "config.el")) ) #+END_SRC - ** Languages *** C# #+BEGIN_SRC emacs-lisp (after! csharp-mode - (defun oreodave/csharp/unit-test () + (defun omnisharp--unit-test-emit-results (passed results) + ; Mostly a copy of the actual omnisharp--unit-test-emit-results function + ; Just allows stdout to come out regardless of whether test has passed or not + (omnisharp--unit-test-message "") + + (seq-doseq (result results) + (-let* (((&alist 'MethodName method-name + 'Outcome outcome + 'ErrorMessage error-message + 'ErrorStackTrace error-stack-trace + 'StandardOutput stdout + 'StanderError stderr) result) + (outcome-is-passed (string-equal "passed" outcome))) + + (omnisharp--unit-test-message + (format "[%s] %s " + (propertize + (upcase outcome) + 'font-lock-face (if outcome-is-passed + '(:foreground "green" :weight bold) + '(:foreground "red" :weight bold))) + (omnisharp--truncate-symbol-name method-name 76))) + + (unless (= (seq-length stdout) 0) + (omnisharp--unit-test-message "Standard output:") + (seq-doseq (stdout-line stdout) + (omnisharp--unit-test-message stdout-line))) + + (unless outcome-is-passed + (omnisharp--unit-test-message error-message) + + (if error-stack-trace + (omnisharp--unit-test-message error-stack-trace)) + + (unless (= (seq-length stderr) 0) + (omnisharp--unit-test-message "Standard error:") + (seq-doseq (stderr-line stderr) + (omnisharp--unit-test-message stderr-line))) + ))) + + (omnisharp--unit-test-message "") + + (if (eq passed :json-false) + (omnisharp--unit-test-message + (propertize "*** UNIT TEST RUN HAS FAILED ***" + 'font-lock-face '(:foreground "red" :weight bold))) + (omnisharp--unit-test-message + (propertize "*** UNIT TEST RUN HAS SUCCEEDED ***" + 'font-lock-face '(:foreground "green" :weight bold))) + ) + nil) (interactive) (omnisharp--cs-inspect-buffer (lambda (elements) |