Easier cleanup strategy

This commit is contained in:
Carlo Sciolla 2017-08-27 12:27:07 +02:00
parent bb33ce840f
commit 5e6810adb6
No known key found for this signature in database
GPG Key ID: BA5D71E6F3C580C1
1 changed files with 14 additions and 11 deletions

View File

@ -19,20 +19,23 @@ equal to OUTPUT. Can choose the output FORMAT (default: utxt)."
(should (equal (replace-regexp-in-string " " "~" (read-test-file output))
(replace-regexp-in-string " " "~" (read-preview-buffer)))))
(defmacro test-and-cleanup-preview (&rest forms)
"Run the test described in FORMS and eventually cleanup the preview buffer."
`(unwind-protect
(progn
,@forms)
(cleanup-preview)))
(ert-deftest preview-utxt-test ()
(unwind-protect
(progn
(setq-local plantuml-jar-path plantuml-test-jar-path)
(assert-preview "a-b.puml" "a-b.txt"))
(cleanup-preview)))
(test-and-cleanup-preview
(setq-local plantuml-jar-path plantuml-test-jar-path)
(assert-preview "a-b.puml" "a-b.txt")))
(ert-deftest preview-unicode-test ()
(unwind-protect
(progn
(setq-local plantuml-jar-path plantuml-test-jar-path)
(setq-local plantuml-output-type "utxt")
(assert-preview "unicode.puml" "unicode.txt")))
(cleanup-preview))
(test-and-cleanup-preview
(setq-local plantuml-jar-path plantuml-test-jar-path)
(setq-local plantuml-output-type "utxt")
(assert-preview "unicode.puml" "unicode.txt")))
(provide 'plantuml-mode-preview-test)