Working test setup which also tests preview
This commit is contained in:
parent
535ed29d16
commit
8752e703de
Binary file not shown.
|
@ -0,0 +1,23 @@
|
|||
;;; plantuml-mode-custom-jar-location-test.el --- PlantUML Mode JAR location tests -*- lexical-binding: t; -*-
|
||||
|
||||
;; Author: Carlo Sciolla (skuro)
|
||||
;; Maintainer: Carlo Sciolla (skuro)
|
||||
;; URL: https://github.com/skuro/plantuml-mode
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(ert-deftest custom-jar-location ()
|
||||
(setq-local plantuml-jar-path "~/.plantuml/plantuml.jar")
|
||||
(should (equal `("-Djava.awt.headless=true" "-jar"
|
||||
,(expand-file-name "~/.plantuml/plantuml.jar"))
|
||||
(plantuml-render-command)))
|
||||
|
||||
(setq-local plantuml-jar-path "/path/with spaces/plantuml.jar")
|
||||
(should (equal `("-Djava.awt.headless=true" "-jar" "/path/with spaces/plantuml.jar")
|
||||
(plantuml-render-command))))
|
||||
|
||||
(provide 'plantuml-mode-custom-jar-location-test)
|
||||
|
||||
;;; plantuml-mode-custom-jar-location-test.el ends here
|
|
@ -12,4 +12,6 @@
|
|||
(should (equal (expand-file-name "~/plantuml.jar")
|
||||
plantuml-jar-path)))
|
||||
|
||||
(provide 'plantuml-mode-test)
|
||||
|
||||
;;; plantuml-mode-test.el ends here
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
;;; plantuml-mode-preview-test.el --- PlantUML Mode preview tests -*- lexical-binding: t; -*-
|
||||
|
||||
;; Author: Carlo Sciolla (skuro)
|
||||
;; Maintainer: Carlo Sciolla (skuro)
|
||||
;; URL: https://github.com/skuro/plantuml-mode
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(ert-deftest preview-test ()
|
||||
(setq-local plantuml-jar-path plantuml-test-jar-path)
|
||||
(setq-local plantuml-output-type "utxt")
|
||||
(plantuml-preview-string 42 (read-test-file "a-b.puml"))
|
||||
(sleep-for 2)
|
||||
(should (equal (read-test-file "a-b.txt") (read-preview-buffer))))
|
||||
|
||||
(provide 'plantuml-mode-preview-test)
|
||||
|
||||
;;; plantuml-mode-preview-test.el ends here
|
|
@ -0,0 +1,5 @@
|
|||
@startuml
|
||||
|
||||
A -> B
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,8 @@
|
|||
┌─┐ ┌─┐
|
||||
│A│ │B│
|
||||
└┬┘ └┬┘
|
||||
│ │
|
||||
│───────────>│
|
||||
┌┴┐ ┌┴┐
|
||||
│A│ │B│
|
||||
└─┘ └─┘
|
|
@ -16,6 +16,22 @@
|
|||
(defvar package-code-path
|
||||
(f-parent package-test-path))
|
||||
|
||||
(defvar plantuml-test-resources-path
|
||||
(f-join package-code-path "test/resources"))
|
||||
|
||||
(defvar plantuml-test-jar-path
|
||||
(f-join package-code-path "bin/plantuml.jar"))
|
||||
|
||||
(defun read-buffer (bufname)
|
||||
(with-current-buffer (get-buffer bufname)
|
||||
(buffer-string)))
|
||||
|
||||
(defun read-preview-buffer ()
|
||||
(read-buffer plantuml-preview-buffer))
|
||||
|
||||
(defun read-test-file (path)
|
||||
(f-read (f-join plantuml-test-resources-path path) 'utf-8))
|
||||
|
||||
(require 'plantuml-mode (f-expand "plantuml-mode.el" package-code-path))
|
||||
|
||||
;;; test-helper.el ends here
|
||||
|
|
Loading…
Reference in New Issue