-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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user