Up the coverage a notch
This commit is contained in:
parent
5cb10712d3
commit
676888feb0
|
@ -161,18 +161,20 @@
|
||||||
(defvar-local plantuml-exec-mode plantuml-default-exec-mode
|
(defvar-local plantuml-exec-mode plantuml-default-exec-mode
|
||||||
"The Plantuml execution mode. See `plantuml-default-exec-mode' for acceptable values.")
|
"The Plantuml execution mode. See `plantuml-default-exec-mode' for acceptable values.")
|
||||||
|
|
||||||
(defun plantuml-set-exec-mode ()
|
(defun plantuml-set-exec-mode (mode)
|
||||||
"Set the execution mode for PlantUML."
|
"Set the execution mode MODE for PlantUML."
|
||||||
(interactive)
|
(interactive (let* ((completion-ignore-case t)
|
||||||
(let* ((completion-ignore-case t)
|
(supported-modes '("jar" "server")))
|
||||||
(supported-modes '("jar" "server")))
|
(completing-read (format "Exec mode [%s]: " plantuml-exec-mode)
|
||||||
(setq plantuml-exec-mode (intern (completing-read (format "Exec mode [%s]: " plantuml-exec-mode)
|
supported-modes
|
||||||
supported-modes
|
nil
|
||||||
nil
|
t
|
||||||
t
|
nil
|
||||||
nil
|
nil
|
||||||
nil
|
plantuml-exec-mode)))
|
||||||
plantuml-exec-mode)))))
|
(if (member mode '("jar" "server"))
|
||||||
|
(setq plantuml-exec-mode (intern mode))
|
||||||
|
(error (concat "Unsupported mode:" mode))))
|
||||||
|
|
||||||
(defun plantuml-enable-debug ()
|
(defun plantuml-enable-debug ()
|
||||||
"Enables debug messages into the *PLANTUML Messages* buffer."
|
"Enables debug messages into the *PLANTUML Messages* buffer."
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
;;; plantuml-config-test.el --- tests for plantuml-mode configuration knobs -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: Carlo Sciolla
|
||||||
|
;; Maintainer: Carlo Sciolla
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test user-accessible configuration knobs
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'plantuml-mode)
|
||||||
|
|
||||||
|
(ert-deftest plantuml-config-test/set-exec-mode-happy-path ()
|
||||||
|
"Test switching execution modes"
|
||||||
|
(let ((orig-mode plantuml-exec-mode))
|
||||||
|
;; happy flows:
|
||||||
|
(plantuml-set-exec-mode "server")
|
||||||
|
(should (equal 'server plantuml-exec-mode))
|
||||||
|
(plantuml-set-exec-mode "jar")
|
||||||
|
(should (equal 'jar plantuml-exec-mode))
|
||||||
|
|
||||||
|
(setq plantuml-exec-mode orig-mode)))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-config-test/set-exec-mode-wrong-mode ()
|
||||||
|
"Test setting the exec mode with the wrong text"
|
||||||
|
:expected-result :failed
|
||||||
|
(plantuml-set-exec-mode "turing-machine"))
|
||||||
|
|
||||||
|
(provide 'plantuml-mode-config-test)
|
||||||
|
|
||||||
|
;;; plantuml-config-test.el ends here
|
Loading…
Reference in New Issue