test-ob-plantuml.el 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ;;; test-ob-plantuml.el --- tests for ob-plantuml.el -*- lexical-binding: t; -*-
  2. ;; Copyright (c) 2016, 2019 Thibault Marin
  3. ;; Authors: Thibault Marin
  4. ;; This file is not part of GNU Emacs.
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. ;;; Code:
  16. (require 'ob-plantuml)
  17. (ert-deftest test-ob-plantuml/single-var ()
  18. "Test file output with input variable."
  19. (should
  20. (string=
  21. "@startuml
  22. !define CLASSNAME test_class
  23. class CLASSNAME
  24. @enduml"
  25. (let ((org-plantuml-jar-path nil))
  26. (org-test-with-temp-text
  27. "#+name: variable_value
  28. : test_class
  29. #+header: :file tmp.puml
  30. #+header: :var CLASSNAME=variable_value
  31. #+begin_src plantuml
  32. class CLASSNAME
  33. #+end_src"
  34. (org-babel-next-src-block)
  35. (let ((src-block-info (cdr (org-babel-get-src-block-info))))
  36. (org-babel-plantuml-make-body
  37. (car src-block-info)
  38. (car (cdr src-block-info)))))))))
  39. (ert-deftest test-ob-plantuml/prologue ()
  40. "Test file output with prologue."
  41. (should
  42. (string=
  43. "@startuml
  44. skinparam classBackgroundColor #FF0000
  45. class test_class
  46. @enduml"
  47. (let ((org-plantuml-jar-path nil))
  48. (org-test-with-temp-text
  49. "#+header: :file tmp.puml
  50. #+header: :prologue skinparam classBackgroundColor #FF0000
  51. #+begin_src plantuml
  52. class test_class
  53. #+end_src"
  54. (org-babel-next-src-block)
  55. (let ((src-block-info (cdr (org-babel-get-src-block-info))))
  56. (org-babel-plantuml-make-body
  57. (car src-block-info)
  58. (car (cdr src-block-info)))))))))
  59. (provide 'test-ob-plantuml)
  60. ;;; test-ob-plantuml.el ends here