Rsch/indentation/multiple start regexs (#88)
* fix version * split indentation rexgexs Split the regexs as a preparation for improvement and enhancement. No explicit enhancement was intended, although the `plantuml-indent-regexp-block-start' covers more blocks now. * enhance and test regexs for groups Changed `plantuml-indent-regexp-group-start' to cover all cases mentioned on sequence diagram page of the plantuml website. Added tests for all elements-with and without label (text following the keyword). * add support and test for box/end box blocks * indentation test for a nested interface block * correction of () at end of file * indentation test for deployment diagram * file “Cask”: added dependency to dash * indentation tests for diagram commons * add indentation tests for component diagrams * regex corrections and added indentation tests for class diagrams correct indentation regexs found by tests for class diagrams * add indentation tests for object diagrams * add indentation tests for state diagrams * enhance indentation class diagram test: abstract class and interface * move indentation tests to diagram test files * mv test/plantuml-indentation-test.el -> test/plantuml-indentation-basics-test.el * add indentation sequence diagram tests and mv basics tests to diagram tests * add indentation for ref-groups * improved indentation for ref-groups * support indentation for activity diagrams - current/old style * indentation support for notes * rm not used regexs * indentation support for plantuml macros * correction: … → etc.
This commit is contained in:
parent
366ecb605a
commit
ef4eecefae
1
Cask
1
Cask
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
(development
|
(development
|
||||||
(depends-on "f")
|
(depends-on "f")
|
||||||
|
(depends-on "dash")
|
||||||
(depends-on "ecukes")
|
(depends-on "ecukes")
|
||||||
(depends-on "ert-runner")
|
(depends-on "ert-runner")
|
||||||
(depends-on "el-mock")
|
(depends-on "el-mock")
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
;; Author: Zhang Weize (zwz)
|
;; Author: Zhang Weize (zwz)
|
||||||
;; Maintainer: Carlo Sciolla (skuro)
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
;; Keywords: uml plantuml ascii
|
;; Keywords: uml plantuml ascii
|
||||||
;; Version: 1.2.7
|
;; Version: 1.2.9
|
||||||
|
;; Package-Version: 1.2.9pre2
|
||||||
;; Package-Requires: ((emacs "25.0"))
|
;; Package-Requires: ((emacs "25.0"))
|
||||||
|
|
||||||
;; This file is free software; you can redistribute it and/or modify
|
;; This file is free software; you can redistribute it and/or modify
|
||||||
|
@ -66,6 +67,7 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'thingatpt)
|
(require 'thingatpt)
|
||||||
|
(require 'dash)
|
||||||
|
|
||||||
(defgroup plantuml-mode nil
|
(defgroup plantuml-mode nil
|
||||||
"Major mode for editing plantuml file."
|
"Major mode for editing plantuml file."
|
||||||
|
@ -79,7 +81,7 @@
|
||||||
|
|
||||||
(defvar plantuml-mode-hook nil "Standard hook for plantuml-mode.")
|
(defvar plantuml-mode-hook nil "Standard hook for plantuml-mode.")
|
||||||
|
|
||||||
(defconst plantuml-mode-version "1.2.7" "The plantuml-mode version string.")
|
(defconst plantuml-mode-version "1.2.9pre2" "The plantuml-mode version string.")
|
||||||
|
|
||||||
(defvar plantuml-mode-debug-enabled nil)
|
(defvar plantuml-mode-debug-enabled nil)
|
||||||
|
|
||||||
|
@ -342,9 +344,40 @@ Uses prefix (as PREFIX) to choose where to display it:
|
||||||
(defvar plantuml-keywords-regexp (concat "^\\s *" (regexp-opt plantuml-keywords 'words) "\\|\\(<\\|<|\\|\\*\\|o\\)\\(\\.+\\|-+\\)\\|\\(\\.+\\|-+\\)\\(>\\||>\\|\\*\\|o\\)\\|\\.\\{2,\\}\\|-\\{2,\\}"))
|
(defvar plantuml-keywords-regexp (concat "^\\s *" (regexp-opt plantuml-keywords 'words) "\\|\\(<\\|<|\\|\\*\\|o\\)\\(\\.+\\|-+\\)\\|\\(\\.+\\|-+\\)\\(>\\||>\\|\\*\\|o\\)\\|\\.\\{2,\\}\\|-\\{2,\\}"))
|
||||||
(defvar plantuml-builtins-regexp (regexp-opt plantuml-builtins 'words))
|
(defvar plantuml-builtins-regexp (regexp-opt plantuml-builtins 'words))
|
||||||
(defvar plantuml-preprocessors-regexp (concat "^\\s *" (regexp-opt plantuml-preprocessors 'words)))
|
(defvar plantuml-preprocessors-regexp (concat "^\\s *" (regexp-opt plantuml-preprocessors 'words)))
|
||||||
(defvar plantuml-indent-regexp-start "^[ \t]*\\(\\(?:.*\\)?\s*\\(?:[<>.*a-z-|]+\\)?\s*\\(?:\\[[a-zA-Z]+\\]\\)?\s+if\s+.*\\|loop\s+.*\\|group\s+.*\\|par\s*$\\|opt\s+.*\\|alt\s+.*\\|else\\|note\s+over\\|note\sas\s.*\\|note\s+\\(\\(?:\\(?:button\\|left\\|right\\|top\\)\\)\\)\\(?:\s+of\\)?\\|\\(?:\\(abstract \\)?class\\|enum\\|package\\|database\\|frame\\|cloud\\|folder\\)\s+.*{\\|activate\s+.+\\)")
|
|
||||||
(defvar plantuml-indent-regexp-end "^[ \t]*\\(endif\\|else\\|end\\|end\s+note\\|.*}\\|deactivate\s+.+\\)")
|
|
||||||
|
|
||||||
|
(defvar plantuml-indent-regexp-block-start "^.*{\s*$"
|
||||||
|
"Indentation regex for all plantuml elements that might define a {} block.
|
||||||
|
Plantuml elements like skinparam, rectangle, sprite, package, etc.
|
||||||
|
The opening { has to be the last visible character in the line (whitespace
|
||||||
|
might follow).")
|
||||||
|
(defvar plantuml-indent-regexp-note-start "^\s*\\(floating\s+\\)?[hr]?note[^:]*?$" "simplyfied regex; note syntax is especially inconsistent across diagrams")
|
||||||
|
(defvar plantuml-indent-regexp-group-start "^\s*\\(alt\\|else\\|opt\\|loop\\|par\\|break\\|critical\\|group\\)\\(?:\s+.+\\|$\\)"
|
||||||
|
"Indentation regex for plantuml group elements that are defined for sequence diagrams.
|
||||||
|
Two variants for groups: keyword is either followed by whitespace and some text
|
||||||
|
or it is followed by line end.")
|
||||||
|
(defvar plantuml-indent-regexp-activate-start "^\s*activate\s+.+$")
|
||||||
|
(defvar plantuml-indent-regexp-box-start "^\s*box\s+.+$")
|
||||||
|
(defvar plantuml-indent-regexp-ref-start "^ref\s+over\s+[^:]+?$")
|
||||||
|
(defvar plantuml-indent-regexp-title-start "^\s*title$")
|
||||||
|
(defvar plantuml-indent-regexp-header-start "^\s*\\(?:\\(?:center\\|left\\|right\\)\s+header\\|header\\)$")
|
||||||
|
(defvar plantuml-indent-regexp-footer-start "^\s*\\(?:\\(?:center\\|left\\|right\\)\s+footer\\|footer\\)$")
|
||||||
|
(defvar plantuml-indent-regexp-legend-start "^\s*\\(?:legend\\|legend\s+\\(?:bottom\\|top\\)\\|legend\s+\\(?:center\\|left\\|right\\)\\|legend\s+\\(?:bottom\\|top\\)\s+\\(?:center\\|left\\|right\\)\\)$")
|
||||||
|
(defvar plantuml-indent-regexp-oldif-start "^.*if\s+\".*\"\s+then$" "used in current activity diagram, sometimes already mentioned as deprecated")
|
||||||
|
(defvar plantuml-indent-regexp-macro-start "^\s*!definelong.*$")
|
||||||
|
(defvar plantuml-indent-regexp-start (list plantuml-indent-regexp-block-start
|
||||||
|
plantuml-indent-regexp-group-start
|
||||||
|
plantuml-indent-regexp-activate-start
|
||||||
|
plantuml-indent-regexp-box-start
|
||||||
|
plantuml-indent-regexp-ref-start
|
||||||
|
plantuml-indent-regexp-legend-start
|
||||||
|
plantuml-indent-regexp-note-start
|
||||||
|
plantuml-indent-regexp-oldif-start
|
||||||
|
plantuml-indent-regexp-title-start
|
||||||
|
plantuml-indent-regexp-header-start
|
||||||
|
plantuml-indent-regexp-footer-start
|
||||||
|
plantuml-indent-regexp-macro-start
|
||||||
|
plantuml-indent-regexp-oldif-start))
|
||||||
|
(defvar plantuml-indent-regexp-end "^\s*\\(?:}\\|endif\\|else\s*.*\\|end\\|end\s+note\\|endhnote\\|endrnote\\|end\s+box\\|end\s+ref\\|deactivate\s+.+\\|end\s+title\\|endheader\\|endfooter\\|endlegend\\|!enddefinelong\\)$")
|
||||||
(setq plantuml-font-lock-keywords
|
(setq plantuml-font-lock-keywords
|
||||||
`(
|
`(
|
||||||
(,plantuml-types-regexp . font-lock-type-face)
|
(,plantuml-types-regexp . font-lock-type-face)
|
||||||
|
@ -400,9 +433,6 @@ Uses prefix (as PREFIX) to choose where to display it:
|
||||||
|
|
||||||
(defun plantuml-current-block-depth ()
|
(defun plantuml-current-block-depth ()
|
||||||
"Trace the current block indentation level by recursively looking back line by line."
|
"Trace the current block indentation level by recursively looking back line by line."
|
||||||
;; forward declare the lazy initialized constants
|
|
||||||
(defvar plantuml-indent-regexp-start)
|
|
||||||
(defvar plantuml-indent-regexp-end)
|
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((relative-depth 0))
|
(let ((relative-depth 0))
|
||||||
;; current line
|
;; current line
|
||||||
|
@ -415,7 +445,7 @@ Uses prefix (as PREFIX) to choose where to display it:
|
||||||
(forward-line -1)
|
(forward-line -1)
|
||||||
(if (looking-at plantuml-indent-regexp-end)
|
(if (looking-at plantuml-indent-regexp-end)
|
||||||
(setq relative-depth (1- relative-depth)))
|
(setq relative-depth (1- relative-depth)))
|
||||||
(if (looking-at plantuml-indent-regexp-start)
|
(if (-any? 'looking-at plantuml-indent-regexp-start)
|
||||||
(setq relative-depth (1+ relative-depth))))
|
(setq relative-depth (1+ relative-depth))))
|
||||||
|
|
||||||
(if (<= relative-depth 0)
|
(if (<= relative-depth 0)
|
||||||
|
@ -426,9 +456,6 @@ Uses prefix (as PREFIX) to choose where to display it:
|
||||||
"Indent the current line to its desired indentation level.
|
"Indent the current line to its desired indentation level.
|
||||||
Restore point to same position in text of the line as before indentation."
|
Restore point to same position in text of the line as before indentation."
|
||||||
(interactive)
|
(interactive)
|
||||||
;; forward declare the lazy initialized constants
|
|
||||||
(defvar plantuml-indent-regexp-start)
|
|
||||||
(defvar plantuml-indent-regexp-end)
|
|
||||||
;; store position of point in line measured from end of line
|
;; store position of point in line measured from end of line
|
||||||
(let ((original-position-eol (- (line-end-position) (point))))
|
(let ((original-position-eol (- (line-end-position) (point))))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
|
|
@ -0,0 +1,281 @@
|
||||||
|
;;; plantuml-indentation-activity-old-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: René Schmelzer
|
||||||
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test indentation for activity (old version) diagrams.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/activity-old-diagram/branches ()
|
||||||
|
"Test correct indentation of plantuml activity-old diagram elements: branches.
|
||||||
|
These code examples are taken from www.plantuml.com"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
if \"Some Test\" then
|
||||||
|
-->[true] \"Some Activity\"
|
||||||
|
--> \"Another activity\"
|
||||||
|
-right-> (*)
|
||||||
|
else
|
||||||
|
->[false] \"Something else\"
|
||||||
|
-->[Ending process] (*)
|
||||||
|
endif
|
||||||
|
|
||||||
|
(*) --> \"check input\"
|
||||||
|
If \"input is verbose\" then
|
||||||
|
--> [Yes] \"turn on verbosity\"
|
||||||
|
--> \"run command\"
|
||||||
|
else
|
||||||
|
--> \"run command\"
|
||||||
|
Endif
|
||||||
|
-->(*)
|
||||||
|
"
|
||||||
|
"
|
||||||
|
if \"Some Test\" then
|
||||||
|
-->[true] \"Some Activity\"
|
||||||
|
--> \"Another activity\"
|
||||||
|
-right-> (*)
|
||||||
|
else
|
||||||
|
->[false] \"Something else\"
|
||||||
|
-->[Ending process] (*)
|
||||||
|
endif
|
||||||
|
|
||||||
|
(*) --> \"check input\"
|
||||||
|
If \"input is verbose\" then
|
||||||
|
--> [Yes] \"turn on verbosity\"
|
||||||
|
--> \"run command\"
|
||||||
|
else
|
||||||
|
--> \"run command\"
|
||||||
|
Endif
|
||||||
|
-->(*)
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/activity-old-diagram/more-on-branches ()
|
||||||
|
"Test correct indentation of plantuml activity-old diagram elements: more on branches.
|
||||||
|
These code examples are taken from www.plantuml.com"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
(*) --> if \"Some Test\" then
|
||||||
|
|
||||||
|
-->[true] \"activity 1\"
|
||||||
|
|
||||||
|
if \"\" then
|
||||||
|
-> \"activity 3\" as a3
|
||||||
|
else
|
||||||
|
if \"Other test\" then
|
||||||
|
-left-> \"activity 5\"
|
||||||
|
else
|
||||||
|
--> \"activity 6\"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
->[false] \"activity 2\"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
a3 --> if \"last test\" then
|
||||||
|
--> \"activity 7\"
|
||||||
|
else
|
||||||
|
-> \"activity 8\"
|
||||||
|
endif
|
||||||
|
"
|
||||||
|
"
|
||||||
|
(*) --> if \"Some Test\" then
|
||||||
|
|
||||||
|
-->[true] \"activity 1\"
|
||||||
|
|
||||||
|
if \"\" then
|
||||||
|
-> \"activity 3\" as a3
|
||||||
|
else
|
||||||
|
if \"Other test\" then
|
||||||
|
-left-> \"activity 5\"
|
||||||
|
else
|
||||||
|
--> \"activity 6\"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
->[false] \"activity 2\"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
a3 --> if \"last test\" then
|
||||||
|
--> \"activity 7\"
|
||||||
|
else
|
||||||
|
-> \"activity 8\"
|
||||||
|
endif
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/activity-old-diagram/partitions ()
|
||||||
|
"Test correct indentation of plantuml activity-old diagram elements: partitions.
|
||||||
|
These code examples are taken from www.plantuml.com"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
partition Conductor {
|
||||||
|
(*) --> \"Climbs on Platform\"
|
||||||
|
--> === S1 ===
|
||||||
|
--> Bows
|
||||||
|
}
|
||||||
|
|
||||||
|
partition Audience #LightSkyBlue {
|
||||||
|
=== S1 === --> Applauds
|
||||||
|
}
|
||||||
|
|
||||||
|
partition Conductor {
|
||||||
|
Bows --> === S2 ===
|
||||||
|
--> WavesArmes
|
||||||
|
Applauds --> === S2 ===
|
||||||
|
}
|
||||||
|
|
||||||
|
partition Orchestra #CCCCEE {
|
||||||
|
WavesArmes --> Introduction
|
||||||
|
--> \"Play music\"
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
partition Conductor {
|
||||||
|
(*) --> \"Climbs on Platform\"
|
||||||
|
--> === S1 ===
|
||||||
|
--> Bows
|
||||||
|
}
|
||||||
|
|
||||||
|
partition Audience #LightSkyBlue {
|
||||||
|
=== S1 === --> Applauds
|
||||||
|
}
|
||||||
|
|
||||||
|
partition Conductor {
|
||||||
|
Bows --> === S2 ===
|
||||||
|
--> WavesArmes
|
||||||
|
Applauds --> === S2 ===
|
||||||
|
}
|
||||||
|
|
||||||
|
partition Orchestra #CCCCEE {
|
||||||
|
WavesArmes --> Introduction
|
||||||
|
--> \"Play music\"
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/activity-old-diagram/complete-example ()
|
||||||
|
"Test correct indentation of plantuml activity-old diagram elements: complete example.
|
||||||
|
These code examples are taken from www.plantuml.com"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
title Servlet Container
|
||||||
|
|
||||||
|
(*) --> \"ClickServlet.handleRequest()\"
|
||||||
|
--> \"new Page\"
|
||||||
|
|
||||||
|
if \"Page.onSecurityCheck\" then
|
||||||
|
->[true] \"Page.onInit()\"
|
||||||
|
|
||||||
|
if \"isForward?\" then
|
||||||
|
->[no] \"Process controls\"
|
||||||
|
|
||||||
|
if \"continue processing?\" then
|
||||||
|
-->[yes] ===RENDERING===
|
||||||
|
else
|
||||||
|
-->[no] ===REDIRECT_CHECK===
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
-->[yes] ===RENDERING===
|
||||||
|
endif
|
||||||
|
|
||||||
|
if \"is Post?\" then
|
||||||
|
-->[yes] \"Page.onPost()\"
|
||||||
|
--> \"Page.onRender()\" as render
|
||||||
|
--> ===REDIRECT_CHECK===
|
||||||
|
else
|
||||||
|
-->[no] \"Page.onGet()\"
|
||||||
|
--> render
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
-->[false] ===REDIRECT_CHECK===
|
||||||
|
endif
|
||||||
|
|
||||||
|
if \"Do redirect?\" then
|
||||||
|
->[yes] \"redirect request\"
|
||||||
|
--> ==BEFORE_DESTROY===
|
||||||
|
else
|
||||||
|
if \"Do Forward?\" then
|
||||||
|
-left->[yes] \"Forward request\"
|
||||||
|
--> ==BEFORE_DESTROY===
|
||||||
|
else
|
||||||
|
-right->[no] \"Render page template\"
|
||||||
|
--> ==BEFORE_DESTROY===
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
--> \"Page.onDestroy()\"
|
||||||
|
-->(*)
|
||||||
|
"
|
||||||
|
"
|
||||||
|
title Servlet Container
|
||||||
|
|
||||||
|
(*) --> \"ClickServlet.handleRequest()\"
|
||||||
|
--> \"new Page\"
|
||||||
|
|
||||||
|
if \"Page.onSecurityCheck\" then
|
||||||
|
->[true] \"Page.onInit()\"
|
||||||
|
|
||||||
|
if \"isForward?\" then
|
||||||
|
->[no] \"Process controls\"
|
||||||
|
|
||||||
|
if \"continue processing?\" then
|
||||||
|
-->[yes] ===RENDERING===
|
||||||
|
else
|
||||||
|
-->[no] ===REDIRECT_CHECK===
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
-->[yes] ===RENDERING===
|
||||||
|
endif
|
||||||
|
|
||||||
|
if \"is Post?\" then
|
||||||
|
-->[yes] \"Page.onPost()\"
|
||||||
|
--> \"Page.onRender()\" as render
|
||||||
|
--> ===REDIRECT_CHECK===
|
||||||
|
else
|
||||||
|
-->[no] \"Page.onGet()\"
|
||||||
|
--> render
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
-->[false] ===REDIRECT_CHECK===
|
||||||
|
endif
|
||||||
|
|
||||||
|
if \"Do redirect?\" then
|
||||||
|
->[yes] \"redirect request\"
|
||||||
|
--> ==BEFORE_DESTROY===
|
||||||
|
else
|
||||||
|
if \"Do Forward?\" then
|
||||||
|
-left->[yes] \"Forward request\"
|
||||||
|
--> ==BEFORE_DESTROY===
|
||||||
|
else
|
||||||
|
-right->[no] \"Render page template\"
|
||||||
|
--> ==BEFORE_DESTROY===
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
--> \"Page.onDestroy()\"
|
||||||
|
-->(*)
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'plantuml-indentation-activity-old-test)
|
||||||
|
|
||||||
|
;;; plantuml-indentation-activity-old-test.el ends here
|
|
@ -1,4 +1,4 @@
|
||||||
;;; plantuml-indentation-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
;;; plantuml-indentation-basics-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Author: Raymond Huang (rymndhng)
|
;; Author: Raymond Huang (rymndhng)
|
||||||
;; Maintainer: Carlo Sciolla (skuro)
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test basics like single correct indentation depth etc. Focus is not on diagram contents
|
||||||
|
;; and context; such things are tested in the diagram specific indentation tests.
|
||||||
;; Test setup is inspired/taken from clojure-mode-indentation-tests
|
;; Test setup is inspired/taken from clojure-mode-indentation-tests
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
@ -255,304 +257,7 @@ foofoo|"
|
||||||
foofoo|"))
|
foofoo|"))
|
||||||
|
|
||||||
|
|
||||||
(defun plantuml-test-indent-block (before after)
|
|
||||||
"The common code for the block indentation tests.
|
|
||||||
|
|
||||||
BEFORE is the text block to be inserted into a temporary buffer.
|
(provide 'plantuml-indentation-basics-test)
|
||||||
AFTER is the expected text block after indentation.
|
|
||||||
|
|
||||||
The temporary buffer will be put into `plantuml-mode'. The whole buffer
|
;;; plantuml-indentation-basics-test.el ends here
|
||||||
will be indented with two spaces for each level of indentation.
|
|
||||||
|
|
||||||
Finally, the indented text in the buffer will be compared with AFTER."
|
|
||||||
|
|
||||||
(with-temp-buffer
|
|
||||||
;; fix the JAR location prior to mode initialization
|
|
||||||
;; for some reason, plantuml-mode disregards the setq-local
|
|
||||||
(setq-local plantuml-jar-path plantuml-test-jar-path)
|
|
||||||
(plantuml-init-once)
|
|
||||||
|
|
||||||
(insert before)
|
|
||||||
(goto-char (point-min))
|
|
||||||
(plantuml-mode)
|
|
||||||
;; use 2 spaces instead of one tab for indentation
|
|
||||||
(setq-local indent-tabs-mode nil)
|
|
||||||
(setq-local tab-width 2)
|
|
||||||
|
|
||||||
(indent-region (point-min) (point-max))
|
|
||||||
(should (equal (buffer-string) after))))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/package-empty ()
|
|
||||||
"Test correct indentation of an empty package block."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
package APackage ()
|
|
||||||
"
|
|
||||||
"
|
|
||||||
package APackage ()
|
|
||||||
"))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/package ()
|
|
||||||
"Test correct indentation of a package block."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
package APackage {
|
|
||||||
A -> B
|
|
||||||
}
|
|
||||||
"
|
|
||||||
"
|
|
||||||
package APackage {
|
|
||||||
A -> B
|
|
||||||
}
|
|
||||||
"))
|
|
||||||
|
|
||||||
(ert-deftest platuml-test-block-indentation/class ()
|
|
||||||
"Test correct indentation of a class block"
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
class Foo {
|
|
||||||
+bar()
|
|
||||||
}
|
|
||||||
"
|
|
||||||
"
|
|
||||||
class Foo {
|
|
||||||
+bar()
|
|
||||||
}
|
|
||||||
")
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
abstract class Foo {
|
|
||||||
+bar()
|
|
||||||
}
|
|
||||||
"
|
|
||||||
"
|
|
||||||
abstract class Foo {
|
|
||||||
+bar()
|
|
||||||
}
|
|
||||||
"))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/various-keywords ()
|
|
||||||
"Test correct indentation of block keywords."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
cloud \"mycloud\" {
|
|
||||||
[Cloud]
|
|
||||||
}
|
|
||||||
"
|
|
||||||
"
|
|
||||||
cloud \"mycloud\" {
|
|
||||||
[Cloud]
|
|
||||||
}
|
|
||||||
")
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
folder \"myfolder\" {
|
|
||||||
[Folder]
|
|
||||||
}
|
|
||||||
"
|
|
||||||
"
|
|
||||||
folder \"myfolder\" {
|
|
||||||
[Folder]
|
|
||||||
}
|
|
||||||
")
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
frame \"myframe\" {
|
|
||||||
[Frame]
|
|
||||||
}
|
|
||||||
"
|
|
||||||
"
|
|
||||||
frame \"myframe\" {
|
|
||||||
[Frame]
|
|
||||||
}
|
|
||||||
"))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/package-database-nested ()
|
|
||||||
"Test correct indentation of two nested blocks, a package and a database.
|
|
||||||
Note: currently the inner database is not indented."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
package APackage {
|
|
||||||
database ADatabase {
|
|
||||||
A -> B
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"
|
|
||||||
"
|
|
||||||
package APackage {
|
|
||||||
database ADatabase {
|
|
||||||
A -> B
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/alt-end ()
|
|
||||||
"Test correct indentation of an alt-end block."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
alt choice 1
|
|
||||||
A -> B
|
|
||||||
end
|
|
||||||
"
|
|
||||||
"
|
|
||||||
alt choice 1
|
|
||||||
A -> B
|
|
||||||
end
|
|
||||||
" ))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/alt-else-end ()
|
|
||||||
"Test correct indentation of an alt-else-end block."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
alt choice 1
|
|
||||||
A -> B
|
|
||||||
else
|
|
||||||
B -> C
|
|
||||||
end
|
|
||||||
"
|
|
||||||
"
|
|
||||||
alt choice 1
|
|
||||||
A -> B
|
|
||||||
else
|
|
||||||
B -> C
|
|
||||||
end
|
|
||||||
" ))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/opt ()
|
|
||||||
"Test correct indentation of an opt block."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
opt event triggered
|
|
||||||
A -> B
|
|
||||||
end
|
|
||||||
"
|
|
||||||
"
|
|
||||||
opt event triggered
|
|
||||||
A -> B
|
|
||||||
end
|
|
||||||
" ))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/par ()
|
|
||||||
"Test correct indentation of a par block."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
par
|
|
||||||
A -> B
|
|
||||||
else
|
|
||||||
C -> B
|
|
||||||
end
|
|
||||||
"
|
|
||||||
"
|
|
||||||
par
|
|
||||||
A -> B
|
|
||||||
else
|
|
||||||
C -> B
|
|
||||||
end
|
|
||||||
" ))
|
|
||||||
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/alt-else-loop-group ()
|
|
||||||
"Test correct indentation of combination of alt-else, loop and group.
|
|
||||||
|
|
||||||
This is taken from the plantuml homepage."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
Alice -> Bob: Authentication Request
|
|
||||||
|
|
||||||
alt successful case
|
|
||||||
|
|
||||||
Bob -> Alice: Authentication Accepted
|
|
||||||
|
|
||||||
else some kind of failure
|
|
||||||
|
|
||||||
Bob -> Alice: Authentication Failure
|
|
||||||
group My own label
|
|
||||||
Alice -> Log : Log attack start
|
|
||||||
loop 1000 times
|
|
||||||
Alice -> Bob: DNS Attack
|
|
||||||
end
|
|
||||||
Alice -> Log : Log attack end
|
|
||||||
end
|
|
||||||
|
|
||||||
else Another type of failure
|
|
||||||
|
|
||||||
Bob -> Alice: Please repeat
|
|
||||||
|
|
||||||
end
|
|
||||||
"
|
|
||||||
"
|
|
||||||
Alice -> Bob: Authentication Request
|
|
||||||
|
|
||||||
alt successful case
|
|
||||||
|
|
||||||
Bob -> Alice: Authentication Accepted
|
|
||||||
|
|
||||||
else some kind of failure
|
|
||||||
|
|
||||||
Bob -> Alice: Authentication Failure
|
|
||||||
group My own label
|
|
||||||
Alice -> Log : Log attack start
|
|
||||||
loop 1000 times
|
|
||||||
Alice -> Bob: DNS Attack
|
|
||||||
end
|
|
||||||
Alice -> Log : Log attack end
|
|
||||||
end
|
|
||||||
|
|
||||||
else Another type of failure
|
|
||||||
|
|
||||||
Bob -> Alice: Please repeat
|
|
||||||
|
|
||||||
end
|
|
||||||
"))
|
|
||||||
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/note-as ()
|
|
||||||
"Test correct indentation of a note-as block."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
note as N1
|
|
||||||
This is a note
|
|
||||||
end note
|
|
||||||
"
|
|
||||||
"
|
|
||||||
note as N1
|
|
||||||
This is a note
|
|
||||||
end note
|
|
||||||
"
|
|
||||||
))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/activate-deactivate ()
|
|
||||||
"Test correct indentation of an activate-deactivate block."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
activate participant_1
|
|
||||||
participant_1 -> participant_2 : f()
|
|
||||||
deactivate participant_1
|
|
||||||
"
|
|
||||||
"
|
|
||||||
activate participant_1
|
|
||||||
participant_1 -> participant_2 : f()
|
|
||||||
deactivate participant_1
|
|
||||||
"))
|
|
||||||
|
|
||||||
(ert-deftest plantuml-test-block-indentation/activate-deactivate-nested ()
|
|
||||||
"Test correct indentation of two nested activate-deactivate blocks."
|
|
||||||
(plantuml-test-indent-block
|
|
||||||
"
|
|
||||||
activate participant_1
|
|
||||||
activate participant_2
|
|
||||||
participant_1 -> participant_2 : f()
|
|
||||||
deactivate participant_2
|
|
||||||
deactivate participant_1
|
|
||||||
"
|
|
||||||
"
|
|
||||||
activate participant_1
|
|
||||||
activate participant_2
|
|
||||||
participant_1 -> participant_2 : f()
|
|
||||||
deactivate participant_2
|
|
||||||
deactivate participant_1
|
|
||||||
"))
|
|
||||||
|
|
||||||
(provide 'plantuml-indentation-test)
|
|
||||||
|
|
||||||
;;; plantuml-indentation-test.el ends here
|
|
|
@ -0,0 +1,351 @@
|
||||||
|
;;; plantuml-indentation-class-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: René Schmelzer
|
||||||
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test indentation for class diagrams.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/class-diagram ()
|
||||||
|
"Test correct indentation of plantuml class diagram elements.
|
||||||
|
These code examples are taken from www.plantuml.com"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
class Dummy {
|
||||||
|
String data
|
||||||
|
void methods()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Flight {
|
||||||
|
flightNumber : Integer
|
||||||
|
departureTime : Date
|
||||||
|
}
|
||||||
|
|
||||||
|
class Dummy1 {
|
||||||
|
{field} A field (despite parentheses)
|
||||||
|
{method} Some method
|
||||||
|
}
|
||||||
|
|
||||||
|
class Dummy2 {
|
||||||
|
-field1
|
||||||
|
#field2
|
||||||
|
~method1()
|
||||||
|
+method2()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Dummy3 {
|
||||||
|
{static} String id
|
||||||
|
{abstract} void methods()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Foo1 {
|
||||||
|
You can use
|
||||||
|
several lines
|
||||||
|
..
|
||||||
|
as you want
|
||||||
|
and group
|
||||||
|
==
|
||||||
|
things together.
|
||||||
|
__
|
||||||
|
You can have as many groups
|
||||||
|
as you want
|
||||||
|
--
|
||||||
|
End of class
|
||||||
|
}
|
||||||
|
|
||||||
|
class User {
|
||||||
|
.. Simple Getter ..
|
||||||
|
+ getName()
|
||||||
|
+ getAddress()
|
||||||
|
.. Some setter ..
|
||||||
|
+ setName()
|
||||||
|
__ private data __
|
||||||
|
int age
|
||||||
|
-- encrypted --
|
||||||
|
String password
|
||||||
|
}
|
||||||
|
|
||||||
|
class ArrayList {
|
||||||
|
Object[] elementData
|
||||||
|
size()
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TimeUnit {
|
||||||
|
DAYS
|
||||||
|
HOURS
|
||||||
|
MINUTES
|
||||||
|
}
|
||||||
|
|
||||||
|
class Dummy4 <<Serializable>> {
|
||||||
|
String name
|
||||||
|
}
|
||||||
|
|
||||||
|
class Foo<? extends Element> {
|
||||||
|
int size()
|
||||||
|
}
|
||||||
|
|
||||||
|
abtract class AbstractC {
|
||||||
|
int size()
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InterfaceC {
|
||||||
|
int size()
|
||||||
|
}
|
||||||
|
|
||||||
|
package \"Classic Collections\" #DDDDDD {
|
||||||
|
Object <|-- ArrayList
|
||||||
|
}
|
||||||
|
|
||||||
|
package net.sourceforge.plantuml {
|
||||||
|
Object <|-- Demo1
|
||||||
|
Demo1 *- Demo2
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo1 <<Node>> {
|
||||||
|
class Class1
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo2 <<Rectangle>> {
|
||||||
|
class Class2
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo3 <<Folder>> {
|
||||||
|
class Class3
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo4 <<Frame>> {
|
||||||
|
class Class4
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo5 <<Cloud>> {
|
||||||
|
class Class5
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo6 <<Database>> {
|
||||||
|
class Class6
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo1.foo2 {
|
||||||
|
class ObjectFoo1Foo2
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo1.foo2.foo3 {
|
||||||
|
class Objectfoo1.foo2.foo3
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace net.dummy #DDDDDD {
|
||||||
|
.BaseClass <|-- Person
|
||||||
|
Meeting o-- Person
|
||||||
|
|
||||||
|
.BaseClass <|- Meeting
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace net.foo {
|
||||||
|
net.dummy.Person <|- Person
|
||||||
|
.BaseClass <|-- Person
|
||||||
|
|
||||||
|
net.dummy.Meeting o-- Person
|
||||||
|
}
|
||||||
|
|
||||||
|
set namespaceSeparator ::
|
||||||
|
class X1::X2::foo {
|
||||||
|
some info
|
||||||
|
}
|
||||||
|
|
||||||
|
together {
|
||||||
|
class Together1
|
||||||
|
class Together2
|
||||||
|
class Together3
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
class Dummy {
|
||||||
|
String data
|
||||||
|
void methods()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Flight {
|
||||||
|
flightNumber : Integer
|
||||||
|
departureTime : Date
|
||||||
|
}
|
||||||
|
|
||||||
|
class Dummy1 {
|
||||||
|
{field} A field (despite parentheses)
|
||||||
|
{method} Some method
|
||||||
|
}
|
||||||
|
|
||||||
|
class Dummy2 {
|
||||||
|
-field1
|
||||||
|
#field2
|
||||||
|
~method1()
|
||||||
|
+method2()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Dummy3 {
|
||||||
|
{static} String id
|
||||||
|
{abstract} void methods()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Foo1 {
|
||||||
|
You can use
|
||||||
|
several lines
|
||||||
|
..
|
||||||
|
as you want
|
||||||
|
and group
|
||||||
|
==
|
||||||
|
things together.
|
||||||
|
__
|
||||||
|
You can have as many groups
|
||||||
|
as you want
|
||||||
|
--
|
||||||
|
End of class
|
||||||
|
}
|
||||||
|
|
||||||
|
class User {
|
||||||
|
.. Simple Getter ..
|
||||||
|
+ getName()
|
||||||
|
+ getAddress()
|
||||||
|
.. Some setter ..
|
||||||
|
+ setName()
|
||||||
|
__ private data __
|
||||||
|
int age
|
||||||
|
-- encrypted --
|
||||||
|
String password
|
||||||
|
}
|
||||||
|
|
||||||
|
class ArrayList {
|
||||||
|
Object[] elementData
|
||||||
|
size()
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TimeUnit {
|
||||||
|
DAYS
|
||||||
|
HOURS
|
||||||
|
MINUTES
|
||||||
|
}
|
||||||
|
|
||||||
|
class Dummy4 <<Serializable>> {
|
||||||
|
String name
|
||||||
|
}
|
||||||
|
|
||||||
|
class Foo<? extends Element> {
|
||||||
|
int size()
|
||||||
|
}
|
||||||
|
|
||||||
|
abtract class AbstractC {
|
||||||
|
int size()
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InterfaceC {
|
||||||
|
int size()
|
||||||
|
}
|
||||||
|
|
||||||
|
package \"Classic Collections\" #DDDDDD {
|
||||||
|
Object <|-- ArrayList
|
||||||
|
}
|
||||||
|
|
||||||
|
package net.sourceforge.plantuml {
|
||||||
|
Object <|-- Demo1
|
||||||
|
Demo1 *- Demo2
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo1 <<Node>> {
|
||||||
|
class Class1
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo2 <<Rectangle>> {
|
||||||
|
class Class2
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo3 <<Folder>> {
|
||||||
|
class Class3
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo4 <<Frame>> {
|
||||||
|
class Class4
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo5 <<Cloud>> {
|
||||||
|
class Class5
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo6 <<Database>> {
|
||||||
|
class Class6
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo1.foo2 {
|
||||||
|
class ObjectFoo1Foo2
|
||||||
|
}
|
||||||
|
|
||||||
|
package foo1.foo2.foo3 {
|
||||||
|
class Objectfoo1.foo2.foo3
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace net.dummy #DDDDDD {
|
||||||
|
.BaseClass <|-- Person
|
||||||
|
Meeting o-- Person
|
||||||
|
|
||||||
|
.BaseClass <|- Meeting
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace net.foo {
|
||||||
|
net.dummy.Person <|- Person
|
||||||
|
.BaseClass <|-- Person
|
||||||
|
|
||||||
|
net.dummy.Meeting o-- Person
|
||||||
|
}
|
||||||
|
|
||||||
|
set namespaceSeparator ::
|
||||||
|
class X1::X2::foo {
|
||||||
|
some info
|
||||||
|
}
|
||||||
|
|
||||||
|
together {
|
||||||
|
class Together1
|
||||||
|
class Together2
|
||||||
|
class Together3
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/class/package-empty ()
|
||||||
|
"Test correct indentation of an empty package block."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
package APackage ()
|
||||||
|
interface Inter
|
||||||
|
"
|
||||||
|
"
|
||||||
|
package APackage ()
|
||||||
|
interface Inter
|
||||||
|
"))
|
||||||
|
|
||||||
|
|
||||||
|
(ert-deftest platuml-test-block-indentation/class/package-interface-nested ()
|
||||||
|
"Test correct indentation of two nested blocks, a package and an interface
|
||||||
|
Note: package is used in deployment and object diagrams as well, see there for more tests."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
package foo {
|
||||||
|
interface Bar {
|
||||||
|
baz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
package foo {
|
||||||
|
interface Bar {
|
||||||
|
baz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'plantuml-indentation-class-test)
|
||||||
|
|
||||||
|
;;; plantuml-indentation-class-test.el ends here
|
|
@ -0,0 +1,340 @@
|
||||||
|
;;; plantuml-indentation-commons-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: René Schmelzer
|
||||||
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test indentation of structures and elements that are common
|
||||||
|
;; to many/all diagrams.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/commons/skinparam ()
|
||||||
|
"Test correct indentation of skinparam elements, which are common to many plantuml diagrams:"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
skinparam roundcorner 20
|
||||||
|
|
||||||
|
skinparam rectangle {
|
||||||
|
roundCorner<<Concept>> 25
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
skinparam roundcorner 20
|
||||||
|
|
||||||
|
skinparam rectangle {
|
||||||
|
roundCorner<<Concept>> 25
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/commons/rectangle ()
|
||||||
|
"Test correct indentation of rectangle elements, which are common to many plantuml diagrams:"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
rectangle \"Concept Model\" <<Concept>> {
|
||||||
|
rectangle \"Example 1\" <<Concept>> as ex1
|
||||||
|
rectangle \"Another rectangle\"
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
rectangle \"Concept Model\" <<Concept>> {
|
||||||
|
rectangle \"Example 1\" <<Concept>> as ex1
|
||||||
|
rectangle \"Another rectangle\"
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/commons/title ()
|
||||||
|
"Test correct indentation of title elements, which are common to many plantuml diagrams:"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
title
|
||||||
|
<font color=red>Warning:</font>
|
||||||
|
Do not use in production.
|
||||||
|
end title
|
||||||
|
"
|
||||||
|
"
|
||||||
|
title
|
||||||
|
<font color=red>Warning:</font>
|
||||||
|
Do not use in production.
|
||||||
|
end title
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/commons/header ()
|
||||||
|
"Test correct indentation of header elements, which are common to many plantuml diagrams:"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
header
|
||||||
|
this is a header
|
||||||
|
endheader
|
||||||
|
|
||||||
|
center header
|
||||||
|
this is a centered header
|
||||||
|
endheader
|
||||||
|
|
||||||
|
right header
|
||||||
|
this is a header on right
|
||||||
|
endheader
|
||||||
|
|
||||||
|
left header
|
||||||
|
this is a header on left
|
||||||
|
endheader
|
||||||
|
|
||||||
|
center left header
|
||||||
|
this is no correct header
|
||||||
|
endheader
|
||||||
|
|
||||||
|
header left
|
||||||
|
this is no correct a header
|
||||||
|
endheader
|
||||||
|
"
|
||||||
|
"
|
||||||
|
header
|
||||||
|
this is a header
|
||||||
|
endheader
|
||||||
|
|
||||||
|
center header
|
||||||
|
this is a centered header
|
||||||
|
endheader
|
||||||
|
|
||||||
|
right header
|
||||||
|
this is a header on right
|
||||||
|
endheader
|
||||||
|
|
||||||
|
left header
|
||||||
|
this is a header on left
|
||||||
|
endheader
|
||||||
|
|
||||||
|
center left header
|
||||||
|
this is no correct header
|
||||||
|
endheader
|
||||||
|
|
||||||
|
header left
|
||||||
|
this is no correct a header
|
||||||
|
endheader
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/commons/footer ()
|
||||||
|
"Test correct indentation of footer elements, which are common to many plantuml diagrams:"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
footer
|
||||||
|
this is a footer
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
center footer
|
||||||
|
this is a centered footer
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
right footer
|
||||||
|
this is a footer on right
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
left footer
|
||||||
|
this is a footer on left
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
center left footer
|
||||||
|
this is no correct footer
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
footer left
|
||||||
|
this is no correct a footer
|
||||||
|
endfooter
|
||||||
|
"
|
||||||
|
"
|
||||||
|
footer
|
||||||
|
this is a footer
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
center footer
|
||||||
|
this is a centered footer
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
right footer
|
||||||
|
this is a footer on right
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
left footer
|
||||||
|
this is a footer on left
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
center left footer
|
||||||
|
this is no correct footer
|
||||||
|
endfooter
|
||||||
|
|
||||||
|
footer left
|
||||||
|
this is no correct a footer
|
||||||
|
endfooter
|
||||||
|
" ))
|
||||||
|
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/commons/legend ()
|
||||||
|
"Test correct indentation of legend elements, which are common to many plantuml diagrams:"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
legend
|
||||||
|
Short legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend bottom
|
||||||
|
bottom legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend top
|
||||||
|
top legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend center
|
||||||
|
centered legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend right
|
||||||
|
legend on right
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend left
|
||||||
|
legend on left
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend bottom left
|
||||||
|
legend on bottom left
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend top left
|
||||||
|
legend on top left
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend bottom right
|
||||||
|
legend on bottom right
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend top right
|
||||||
|
legend on top right
|
||||||
|
endlegend
|
||||||
|
"
|
||||||
|
"
|
||||||
|
legend
|
||||||
|
Short legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend bottom
|
||||||
|
bottom legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend top
|
||||||
|
top legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend center
|
||||||
|
centered legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend right
|
||||||
|
legend on right
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend left
|
||||||
|
legend on left
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend bottom left
|
||||||
|
legend on bottom left
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend top left
|
||||||
|
legend on top left
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend bottom right
|
||||||
|
legend on bottom right
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend top right
|
||||||
|
legend on top right
|
||||||
|
endlegend
|
||||||
|
" ))
|
||||||
|
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/commons/legend-noindent ()
|
||||||
|
"Test the not-indentation of false legend elements."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
legend bottom top
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend right bottom
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend left top
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend center right
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend center left
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend right left
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
"
|
||||||
|
"
|
||||||
|
legend bottom top
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend right bottom
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend left top
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend center right
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend center left
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
|
||||||
|
legend right left
|
||||||
|
this is no correct legend
|
||||||
|
endlegend
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/commons/multiline-macro ()
|
||||||
|
"Test the indentation of multiline macro elements."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
!define DOUBLE(x) x x
|
||||||
|
!definelong AUTHEN(x,y)
|
||||||
|
x -> y : DOUBLE(hello)
|
||||||
|
y -> x : ok
|
||||||
|
!enddefinelong
|
||||||
|
|
||||||
|
AUTHEN(Bob,Alice)
|
||||||
|
"
|
||||||
|
"
|
||||||
|
!define DOUBLE(x) x x
|
||||||
|
!definelong AUTHEN(x,y)
|
||||||
|
x -> y : DOUBLE(hello)
|
||||||
|
y -> x : ok
|
||||||
|
!enddefinelong
|
||||||
|
|
||||||
|
AUTHEN(Bob,Alice)
|
||||||
|
"
|
||||||
|
))
|
||||||
|
;;; plantuml-indentation-commons-test.el ends here
|
|
@ -0,0 +1,69 @@
|
||||||
|
;;; plantuml-indentation-component-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: René Schmelzer
|
||||||
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test indentation for component diagrams.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/component-diagram ()
|
||||||
|
"Test correct indentation of plantuml component diagram elements.
|
||||||
|
These code examples are taken from www.plantuml.com"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
package \"Some Group\" {
|
||||||
|
HTTP - [First Component]
|
||||||
|
[Another Component]
|
||||||
|
}
|
||||||
|
|
||||||
|
node \"Other Groups\" {
|
||||||
|
FTP - [Second Component]
|
||||||
|
[First Component] --> FTP
|
||||||
|
}
|
||||||
|
|
||||||
|
cloud {
|
||||||
|
[Example 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
database \"MySql\" {
|
||||||
|
folder \"This is my folder\" {
|
||||||
|
[Folder 3]
|
||||||
|
}
|
||||||
|
frame \"Foo\" {
|
||||||
|
[Frame 4]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
package \"Some Group\" {
|
||||||
|
HTTP - [First Component]
|
||||||
|
[Another Component]
|
||||||
|
}
|
||||||
|
|
||||||
|
node \"Other Groups\" {
|
||||||
|
FTP - [Second Component]
|
||||||
|
[First Component] --> FTP
|
||||||
|
}
|
||||||
|
|
||||||
|
cloud {
|
||||||
|
[Example 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
database \"MySql\" {
|
||||||
|
folder \"This is my folder\" {
|
||||||
|
[Folder 3]
|
||||||
|
}
|
||||||
|
frame \"Foo\" {
|
||||||
|
[Frame 4]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
(provide 'plantuml-indentation-component-test)
|
||||||
|
|
||||||
|
;;; plantuml-indentation-component-test.el ends here
|
|
@ -0,0 +1,111 @@
|
||||||
|
;;; plantuml-indentation-deployment-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: René Schmelzer
|
||||||
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test indentation for deployment diagrams.
|
||||||
|
;; Most plantuml code examples are taken from www.plantuml.com
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/deployment-diagram ()
|
||||||
|
"Test correct indentation of plantuml deployment diagram elements."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
artifact Foo1 {
|
||||||
|
folder Foo2
|
||||||
|
}
|
||||||
|
|
||||||
|
folder Foo3 {
|
||||||
|
artifact Foo4
|
||||||
|
}
|
||||||
|
|
||||||
|
frame Foo5 {
|
||||||
|
database Foo6
|
||||||
|
}
|
||||||
|
|
||||||
|
cloud vpc {
|
||||||
|
node ec2 {
|
||||||
|
stack stack
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
node Foo1 {
|
||||||
|
cloud Foo2
|
||||||
|
}
|
||||||
|
|
||||||
|
cloud Foo3 {
|
||||||
|
frame Foo4
|
||||||
|
}
|
||||||
|
|
||||||
|
database Foo5 {
|
||||||
|
storage Foo6
|
||||||
|
}
|
||||||
|
|
||||||
|
storage Foo7 {
|
||||||
|
storage Foo8
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
artifact Foo1 {
|
||||||
|
folder Foo2
|
||||||
|
}
|
||||||
|
|
||||||
|
folder Foo3 {
|
||||||
|
artifact Foo4
|
||||||
|
}
|
||||||
|
|
||||||
|
frame Foo5 {
|
||||||
|
database Foo6
|
||||||
|
}
|
||||||
|
|
||||||
|
cloud vpc {
|
||||||
|
node ec2 {
|
||||||
|
stack stack
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
node Foo1 {
|
||||||
|
cloud Foo2
|
||||||
|
}
|
||||||
|
|
||||||
|
cloud Foo3 {
|
||||||
|
frame Foo4
|
||||||
|
}
|
||||||
|
|
||||||
|
database Foo5 {
|
||||||
|
storage Foo6
|
||||||
|
}
|
||||||
|
|
||||||
|
storage Foo7 {
|
||||||
|
storage Foo8
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/package-database-nested ()
|
||||||
|
"Test correct indentation of two nested blocks, a package and a database.
|
||||||
|
Note: package is used in class and object diagrams as well, see there for more tests."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
package APackage {
|
||||||
|
database ADatabase {
|
||||||
|
A -> B
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
package APackage {
|
||||||
|
database ADatabase {
|
||||||
|
A -> B
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'plantuml-indentation-deployment-test)
|
||||||
|
|
||||||
|
;;; plantuml-indentation-deployment-test.el ends here
|
|
@ -0,0 +1,403 @@
|
||||||
|
;;; plantuml-indentation-notes-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: René Schmelzer
|
||||||
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test indentation of note elements.
|
||||||
|
;; Notes are used in almost all diagrams, but not all types of notes
|
||||||
|
;; are supported in every diagram type.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/note-simple ()
|
||||||
|
"Test correct indentation of a simple note block."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
note: single line note
|
||||||
|
|
||||||
|
note
|
||||||
|
multi line note
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
"
|
||||||
|
note: single line note
|
||||||
|
|
||||||
|
note
|
||||||
|
multi line note
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/note-left-right ()
|
||||||
|
"Test correct indentation of a note left/right block."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
(*) --> \"Some Activity\"
|
||||||
|
note right: This activity has to be defined
|
||||||
|
\"Some Activity\" --> (*)
|
||||||
|
|
||||||
|
note right
|
||||||
|
This note is on
|
||||||
|
several lines
|
||||||
|
end note
|
||||||
|
|
||||||
|
(*) --> \"Some Activity\"
|
||||||
|
note left: This activity has to be defined
|
||||||
|
\"Some Activity\" --> (*)
|
||||||
|
|
||||||
|
note left
|
||||||
|
This note is on
|
||||||
|
several lines
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
"
|
||||||
|
(*) --> \"Some Activity\"
|
||||||
|
note right: This activity has to be defined
|
||||||
|
\"Some Activity\" --> (*)
|
||||||
|
|
||||||
|
note right
|
||||||
|
This note is on
|
||||||
|
several lines
|
||||||
|
end note
|
||||||
|
|
||||||
|
(*) --> \"Some Activity\"
|
||||||
|
note left: This activity has to be defined
|
||||||
|
\"Some Activity\" --> (*)
|
||||||
|
|
||||||
|
note left
|
||||||
|
This note is on
|
||||||
|
several lines
|
||||||
|
end note
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/note-xxx-of ()
|
||||||
|
"Test correct indentation of a note xxx of block.
|
||||||
|
plantuml.com:
|
||||||
|
You can use the note left of, note right of, note top of,
|
||||||
|
note bottom of keywords to define notes related to a single
|
||||||
|
object."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
note right of Alice: This is displayed right of Alice.
|
||||||
|
|
||||||
|
note left of Alice #aqua
|
||||||
|
This is displayed
|
||||||
|
left of Alice.
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Alice: This is displayed left of Alice.
|
||||||
|
|
||||||
|
note right of Alice #aqua
|
||||||
|
This is displayed
|
||||||
|
right of Alice.
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of (Use)
|
||||||
|
A note can also
|
||||||
|
be on several lines
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of HTTP : Web Service only
|
||||||
|
|
||||||
|
note right of [First Component]
|
||||||
|
A note can also
|
||||||
|
be on several lines
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
"
|
||||||
|
note right of Alice: This is displayed right of Alice.
|
||||||
|
|
||||||
|
note left of Alice #aqua
|
||||||
|
This is displayed
|
||||||
|
left of Alice.
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Alice: This is displayed left of Alice.
|
||||||
|
|
||||||
|
note right of Alice #aqua
|
||||||
|
This is displayed
|
||||||
|
right of Alice.
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of (Use)
|
||||||
|
A note can also
|
||||||
|
be on several lines
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of HTTP : Web Service only
|
||||||
|
|
||||||
|
note right of [First Component]
|
||||||
|
A note can also
|
||||||
|
be on several lines
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/note-on-link ()
|
||||||
|
"Test correct indentation of a note xxx of block.
|
||||||
|
plantuml.com:
|
||||||
|
“You can also use note left on link, note right on link,
|
||||||
|
note top on link, note bottom on link if you want to change
|
||||||
|
the relative position of the note with the label.”"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
class Dummy
|
||||||
|
Dummy --> Foo : A link
|
||||||
|
note on link #red: note that is red
|
||||||
|
|
||||||
|
Dummy --> Foo2 : Another link
|
||||||
|
note right on link #blue
|
||||||
|
this is my note on right link
|
||||||
|
and in blue
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left on link #00FFFF
|
||||||
|
this is my note on left link
|
||||||
|
and in color as number
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
"
|
||||||
|
class Dummy
|
||||||
|
Dummy --> Foo : A link
|
||||||
|
note on link #red: note that is red
|
||||||
|
|
||||||
|
Dummy --> Foo2 : Another link
|
||||||
|
note right on link #blue
|
||||||
|
this is my note on right link
|
||||||
|
and in blue
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left on link #00FFFF
|
||||||
|
this is my note on left link
|
||||||
|
and in color as number
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/note-over ()
|
||||||
|
"Test correct indentation of a note-over block."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
note over Alice: This is displayed over Alice.
|
||||||
|
|
||||||
|
note over Alice, Bob #FFAAAA: This is displayed over Bob and Alice.
|
||||||
|
|
||||||
|
note over Bob, Alice
|
||||||
|
This is yet another
|
||||||
|
example of
|
||||||
|
a long note.
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
"
|
||||||
|
note over Alice: This is displayed over Alice.
|
||||||
|
|
||||||
|
note over Alice, Bob #FFAAAA: This is displayed over Bob and Alice.
|
||||||
|
|
||||||
|
note over Bob, Alice
|
||||||
|
This is yet another
|
||||||
|
example of
|
||||||
|
a long note.
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
;; Here we have an inconsistency (again) in plantuml syntax
|
||||||
|
;; single line ‘note as …’ does not contain a ?:
|
||||||
|
;;
|
||||||
|
;; (ert-deftest plantuml-test-block-indentation/note-as ()
|
||||||
|
;; "Test correct indentation of a note-as block."
|
||||||
|
;; (plantuml-test-indent-block
|
||||||
|
;; "
|
||||||
|
;; :Main Admin: as Admin
|
||||||
|
;; (Use the application) as (Use)
|
||||||
|
|
||||||
|
;; User -> (Start)
|
||||||
|
;; User --> (Use)
|
||||||
|
|
||||||
|
;; Admin ---> (Use)
|
||||||
|
|
||||||
|
;; note right of Admin : This is an example.
|
||||||
|
|
||||||
|
;; note right of (Use)
|
||||||
|
;; A note can also
|
||||||
|
;; be on several lines
|
||||||
|
;; end note
|
||||||
|
|
||||||
|
;; note \"This note is connected to several objects.\" as N2 #RED
|
||||||
|
;; (Start) .. N2
|
||||||
|
;; N2 .. (Use)
|
||||||
|
|
||||||
|
;; note as N3 #blue
|
||||||
|
;; This note is connected
|
||||||
|
;; to several objects as well.
|
||||||
|
;; end note
|
||||||
|
;; (Start) .. N3
|
||||||
|
;; N3 .. Admin
|
||||||
|
;; "
|
||||||
|
;; "
|
||||||
|
;; :Main Admin: as Admin
|
||||||
|
;; (Use the application) as (Use)
|
||||||
|
|
||||||
|
;; User -> (Start)
|
||||||
|
;; User --> (Use)
|
||||||
|
|
||||||
|
;; Admin ---> (Use)
|
||||||
|
|
||||||
|
;; note right of Admin : This is an example.
|
||||||
|
|
||||||
|
;; note right of (Use)
|
||||||
|
;; A note can also
|
||||||
|
;; be on several lines
|
||||||
|
;; end note
|
||||||
|
|
||||||
|
;; note \"This note is connected to several objects.\" as N2 #RED
|
||||||
|
;; (Start) .. N2
|
||||||
|
;; N2 .. (Use)
|
||||||
|
|
||||||
|
;; note as N3 #blue
|
||||||
|
;; This note is connected
|
||||||
|
;; to several objects as well.
|
||||||
|
;; end note
|
||||||
|
|
||||||
|
;; (Start) .. N3
|
||||||
|
;; N3 .. Admin
|
||||||
|
;; "
|
||||||
|
;; ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/note-floating ()
|
||||||
|
"Test correct indentation of a floating note block."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
floating note left: This is a note
|
||||||
|
:foo2;
|
||||||
|
|
||||||
|
floating note right
|
||||||
|
This note is on several
|
||||||
|
//lines// and can
|
||||||
|
contain <b>HTML</b>
|
||||||
|
====
|
||||||
|
* Calling the method \"\"foo()\"\" is prohibited
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
"
|
||||||
|
floating note left: This is a note
|
||||||
|
:foo2;
|
||||||
|
|
||||||
|
floating note right
|
||||||
|
This note is on several
|
||||||
|
//lines// and can
|
||||||
|
contain <b>HTML</b>
|
||||||
|
====
|
||||||
|
* Calling the method \"\"foo()\"\" is prohibited
|
||||||
|
end note
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/note-h-r-note ()
|
||||||
|
"Test correct indentation of a [hr]note block."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
caller -> server : conReq
|
||||||
|
rnote over caller : idle
|
||||||
|
hnote over caller : idle
|
||||||
|
caller <- server : conConf
|
||||||
|
|
||||||
|
rnote over server
|
||||||
|
r as rectangle
|
||||||
|
h as hexagon
|
||||||
|
endrnote
|
||||||
|
|
||||||
|
hnote over server
|
||||||
|
r as rectangle
|
||||||
|
h as hexagon
|
||||||
|
endrnote
|
||||||
|
"
|
||||||
|
"
|
||||||
|
caller -> server : conReq
|
||||||
|
rnote over caller : idle
|
||||||
|
hnote over caller : idle
|
||||||
|
caller <- server : conConf
|
||||||
|
|
||||||
|
rnote over server
|
||||||
|
r as rectangle
|
||||||
|
h as hexagon
|
||||||
|
endrnote
|
||||||
|
|
||||||
|
hnote over server
|
||||||
|
r as rectangle
|
||||||
|
h as hexagon
|
||||||
|
endrnote
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/note-creole-html ()
|
||||||
|
"Test correct indentation of a note block with creole/html."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
participant Alice
|
||||||
|
participant \"The **Famous** Bob\" as Bob
|
||||||
|
|
||||||
|
Alice -> Bob : hello --there--
|
||||||
|
... Some ~~long delay~~ ...
|
||||||
|
Bob -> Alice : ok
|
||||||
|
note left
|
||||||
|
This is **bold**
|
||||||
|
This is //italics//
|
||||||
|
This is \"\"monospaced\"\"
|
||||||
|
This is --stroked--
|
||||||
|
This is __underlined__
|
||||||
|
This is ~~waved~~
|
||||||
|
end note
|
||||||
|
|
||||||
|
Alice -> Bob : A //well formatted// message
|
||||||
|
note right of Alice
|
||||||
|
This is <back:cadetblue><size:18>displayed</size></back>
|
||||||
|
__left of__ Alice.
|
||||||
|
end note
|
||||||
|
note left of Bob
|
||||||
|
<u:red>This</u> is <color #118888>displayed</color>
|
||||||
|
**<color purple>left of</color> <s:red>Alice</strike> Bob**.
|
||||||
|
end note
|
||||||
|
note over Alice, Bob
|
||||||
|
<w:#FF33FF>This is hosted</w> by <img sourceforge.jpg>
|
||||||
|
end note
|
||||||
|
|
||||||
|
"
|
||||||
|
"
|
||||||
|
participant Alice
|
||||||
|
participant \"The **Famous** Bob\" as Bob
|
||||||
|
|
||||||
|
Alice -> Bob : hello --there--
|
||||||
|
... Some ~~long delay~~ ...
|
||||||
|
Bob -> Alice : ok
|
||||||
|
note left
|
||||||
|
This is **bold**
|
||||||
|
This is //italics//
|
||||||
|
This is \"\"monospaced\"\"
|
||||||
|
This is --stroked--
|
||||||
|
This is __underlined__
|
||||||
|
This is ~~waved~~
|
||||||
|
end note
|
||||||
|
|
||||||
|
Alice -> Bob : A //well formatted// message
|
||||||
|
note right of Alice
|
||||||
|
This is <back:cadetblue><size:18>displayed</size></back>
|
||||||
|
__left of__ Alice.
|
||||||
|
end note
|
||||||
|
note left of Bob
|
||||||
|
<u:red>This</u> is <color #118888>displayed</color>
|
||||||
|
**<color purple>left of</color> <s:red>Alice</strike> Bob**.
|
||||||
|
end note
|
||||||
|
note over Alice, Bob
|
||||||
|
<w:#FF33FF>This is hosted</w> by <img sourceforge.jpg>
|
||||||
|
end note
|
||||||
|
|
||||||
|
"
|
||||||
|
))
|
||||||
|
|
||||||
|
;;; plantuml-indentation-notes-test.el ends here
|
|
@ -0,0 +1,34 @@
|
||||||
|
;;; plantuml-indentation-object-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: René Schmelzer
|
||||||
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test indentation for object diagrams.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/object-diagram ()
|
||||||
|
"Test correct indentation of plantuml object diagram elements.
|
||||||
|
These code examples are taken from www.plantuml.com
|
||||||
|
Note: object diagrams use many elements defined for class diagrams."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
object user {
|
||||||
|
name = \"Dummy\"
|
||||||
|
id = 123
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
object user {
|
||||||
|
name = \"Dummy\"
|
||||||
|
id = 123
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
(provide 'plantuml-indentation-object-test)
|
||||||
|
|
||||||
|
;;; plantuml-indentation-object-test.el ends here
|
|
@ -0,0 +1,362 @@
|
||||||
|
;;; plantuml-indentation-sequence-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: René Schmelzer
|
||||||
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test indentation for sequence diagrams.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
|
||||||
|
(ert-deftest platuml-test-block-indentation/sequence/box ()
|
||||||
|
"Test correct indentation of a box block"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
box \"Device with USB connector\"
|
||||||
|
actor Human
|
||||||
|
participant UsbDetector
|
||||||
|
end box
|
||||||
|
"
|
||||||
|
"
|
||||||
|
box \"Device with USB connector\"
|
||||||
|
actor Human
|
||||||
|
participant UsbDetector
|
||||||
|
end box
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest platuml-test-block-indentation/sequence/ref ()
|
||||||
|
"Test correct indentation of a ref block"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
participant Alice
|
||||||
|
actor Bob
|
||||||
|
participant \"Great Cesar\"
|
||||||
|
|
||||||
|
ref over Alice, Bob : init
|
||||||
|
|
||||||
|
Alice -> Bob : hello
|
||||||
|
|
||||||
|
ref over Bob, \"Great Cesar\"
|
||||||
|
This can be on
|
||||||
|
several lines
|
||||||
|
end ref
|
||||||
|
|
||||||
|
ref over Bob
|
||||||
|
This is a ref over Bob
|
||||||
|
end ref
|
||||||
|
|
||||||
|
ref over \"Great Cesar\"
|
||||||
|
This is a ref over \"Great Cesar\"
|
||||||
|
end ref
|
||||||
|
"
|
||||||
|
|
||||||
|
"
|
||||||
|
participant Alice
|
||||||
|
actor Bob
|
||||||
|
participant \"Great Cesar\"
|
||||||
|
|
||||||
|
ref over Alice, Bob : init
|
||||||
|
|
||||||
|
Alice -> Bob : hello
|
||||||
|
|
||||||
|
ref over Bob, \"Great Cesar\"
|
||||||
|
This can be on
|
||||||
|
several lines
|
||||||
|
end ref
|
||||||
|
|
||||||
|
ref over Bob
|
||||||
|
This is a ref over Bob
|
||||||
|
end ref
|
||||||
|
|
||||||
|
ref over \"Great Cesar\"
|
||||||
|
This is a ref over \"Great Cesar\"
|
||||||
|
end ref
|
||||||
|
" ))
|
||||||
|
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/alt-end ()
|
||||||
|
"Test correct indentation of an alt-end block.
|
||||||
|
The alt-keyword is NOT followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
alt
|
||||||
|
A -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
alt
|
||||||
|
A -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/alt-end-with-label ()
|
||||||
|
"Test correct indentation of an alt-end block.
|
||||||
|
The alt-keyword is followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
alt choice 1
|
||||||
|
A -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
alt choice 1
|
||||||
|
A -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/alt-else-end ()
|
||||||
|
"Test correct indentation of an alt-else-end block."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
alt choice 1
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
B -> C
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
alt choice 1
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
B -> C
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/opt ()
|
||||||
|
"Test correct indentation of an opt block.
|
||||||
|
The opt-keyword is NOT followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
opt
|
||||||
|
A -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
opt
|
||||||
|
A -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/opt-with-label ()
|
||||||
|
"Test correct indentation of an opt block.
|
||||||
|
The opt-keyword is followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
opt event triggered
|
||||||
|
A -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
opt event triggered
|
||||||
|
A -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/par ()
|
||||||
|
"Test correct indentation of a par block.
|
||||||
|
The par-keyword is NOT followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
par
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
par
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/par-with-label ()
|
||||||
|
"Test correct indentation of a par block.
|
||||||
|
The par-keyword is followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
par a text label
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
par a text label
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/group ()
|
||||||
|
"Test correct indentation of a group block.
|
||||||
|
The group-keyword is NOT followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
group
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
group
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/group-with-label ()
|
||||||
|
"Test correct indentation of a group block.
|
||||||
|
The group-keyword is followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
group my own label
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
group my own label
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/critical ()
|
||||||
|
"Test correct indentation of a critical block.
|
||||||
|
The critical-keyword is NOT followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
critical
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
critical
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/critical-with-label ()
|
||||||
|
"Test correct indentation of a critical block.
|
||||||
|
The critical-keyword is followed by some text."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
critical my own label
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
critical my own label
|
||||||
|
A -> B
|
||||||
|
else
|
||||||
|
C -> B
|
||||||
|
end
|
||||||
|
" ))
|
||||||
|
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/activate-deactivate ()
|
||||||
|
"Test correct indentation of an activate-deactivate block."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
activate participant_1
|
||||||
|
participant_1 -> participant_2 : f()
|
||||||
|
deactivate participant_1
|
||||||
|
"
|
||||||
|
"
|
||||||
|
activate participant_1
|
||||||
|
participant_1 -> participant_2 : f()
|
||||||
|
deactivate participant_1
|
||||||
|
"))
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-block-indentation/sequence/activate-deactivate-nested ()
|
||||||
|
"Test correct indentation of two nested activate-deactivate blocks."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
activate participant_1
|
||||||
|
activate participant_2
|
||||||
|
participant_1 -> participant_2 : f()
|
||||||
|
deactivate participant_2
|
||||||
|
deactivate participant_1
|
||||||
|
"
|
||||||
|
"
|
||||||
|
activate participant_1
|
||||||
|
activate participant_2
|
||||||
|
participant_1 -> participant_2 : f()
|
||||||
|
deactivate participant_2
|
||||||
|
deactivate participant_1
|
||||||
|
"))
|
||||||
|
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/sequence-diagram ()
|
||||||
|
"Test correct indentation of plantuml sequence diagram elements.
|
||||||
|
These code examples are taken from www.plantuml.com."
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
"
|
||||||
|
Alice -> Bob: Authentication Request
|
||||||
|
|
||||||
|
alt successful case
|
||||||
|
|
||||||
|
Bob -> Alice: Authentication Accepted
|
||||||
|
|
||||||
|
else some kind of failure
|
||||||
|
|
||||||
|
Bob -> Alice: Authentication Failure
|
||||||
|
group My own label
|
||||||
|
Alice -> Log : Log attack start
|
||||||
|
loop 1000 times
|
||||||
|
Alice -> Bob: DNS Attack
|
||||||
|
end
|
||||||
|
Alice -> Log : Log attack end
|
||||||
|
end
|
||||||
|
|
||||||
|
else Another type of failure
|
||||||
|
|
||||||
|
Bob -> Alice: Please repeat
|
||||||
|
|
||||||
|
end
|
||||||
|
"
|
||||||
|
"
|
||||||
|
Alice -> Bob: Authentication Request
|
||||||
|
|
||||||
|
alt successful case
|
||||||
|
|
||||||
|
Bob -> Alice: Authentication Accepted
|
||||||
|
|
||||||
|
else some kind of failure
|
||||||
|
|
||||||
|
Bob -> Alice: Authentication Failure
|
||||||
|
group My own label
|
||||||
|
Alice -> Log : Log attack start
|
||||||
|
loop 1000 times
|
||||||
|
Alice -> Bob: DNS Attack
|
||||||
|
end
|
||||||
|
Alice -> Log : Log attack end
|
||||||
|
end
|
||||||
|
|
||||||
|
else Another type of failure
|
||||||
|
|
||||||
|
Bob -> Alice: Please repeat
|
||||||
|
|
||||||
|
end
|
||||||
|
"))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'plantuml-indentation-sequence-test)
|
||||||
|
|
||||||
|
;;; plantuml-indentation-sequence-test.el ends here
|
|
@ -0,0 +1,119 @@
|
||||||
|
;;; plantuml-indentation-state-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Author: René Schmelzer
|
||||||
|
;; Maintainer: Carlo Sciolla (skuro)
|
||||||
|
;; URL: https://github.com/skuro/plantuml-mode
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Test indentation for state diagrams.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(ert-deftest plantuml-test-indentation/state-diagram ()
|
||||||
|
"Test correct indentation of plantuml state diagram elements.
|
||||||
|
These code examples are taken from www.plantuml.com"
|
||||||
|
(plantuml-test-indent-block
|
||||||
|
|
||||||
|
"
|
||||||
|
state NotShooting {
|
||||||
|
[*] --> Idle
|
||||||
|
Idle --> Configuring : EvConfig
|
||||||
|
Configuring --> Idle : EvConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
state Configuring {
|
||||||
|
[*] --> NewValueSelection
|
||||||
|
NewValueSelection --> NewValuePreview : EvNewValue
|
||||||
|
NewValuePreview --> NewValueSelection : EvNewValueRejected
|
||||||
|
NewValuePreview --> NewValueSelection : EvNewValueSaved
|
||||||
|
|
||||||
|
state NewValuePreview {
|
||||||
|
State1 -> State2
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
state State3 {
|
||||||
|
state \"Accumulate Enough Data\\nLong State Name\" as long1
|
||||||
|
long1 : Just a test
|
||||||
|
[*] --> long1
|
||||||
|
long1 --> long1 : New Data
|
||||||
|
long1 --> ProcessData : Enough Data
|
||||||
|
}
|
||||||
|
|
||||||
|
state Active {
|
||||||
|
[*] -> NumLockOff
|
||||||
|
NumLockOff --> NumLockOn : EvNumLockPressed
|
||||||
|
NumLockOn --> NumLockOff : EvNumLockPressed
|
||||||
|
--
|
||||||
|
[*] -> CapsLockOff
|
||||||
|
CapsLockOff --> CapsLockOn : EvCapsLockPressed
|
||||||
|
CapsLockOn --> CapsLockOff : EvCapsLockPressed
|
||||||
|
--
|
||||||
|
[*] -> ScrollLockOff
|
||||||
|
ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
|
||||||
|
ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
|
||||||
|
}
|
||||||
|
|
||||||
|
state \"Not Shooting State\" as NotShooting {
|
||||||
|
state \"Idle mode\" as Idle
|
||||||
|
state \"Configuring mode\" as Configuring
|
||||||
|
[*] --> Idle
|
||||||
|
Idle --> Configuring : EvConfig
|
||||||
|
Configuring --> Idle : EvConfig
|
||||||
|
}
|
||||||
|
"
|
||||||
|
"
|
||||||
|
state NotShooting {
|
||||||
|
[*] --> Idle
|
||||||
|
Idle --> Configuring : EvConfig
|
||||||
|
Configuring --> Idle : EvConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
state Configuring {
|
||||||
|
[*] --> NewValueSelection
|
||||||
|
NewValueSelection --> NewValuePreview : EvNewValue
|
||||||
|
NewValuePreview --> NewValueSelection : EvNewValueRejected
|
||||||
|
NewValuePreview --> NewValueSelection : EvNewValueSaved
|
||||||
|
|
||||||
|
state NewValuePreview {
|
||||||
|
State1 -> State2
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
state State3 {
|
||||||
|
state \"Accumulate Enough Data\\nLong State Name\" as long1
|
||||||
|
long1 : Just a test
|
||||||
|
[*] --> long1
|
||||||
|
long1 --> long1 : New Data
|
||||||
|
long1 --> ProcessData : Enough Data
|
||||||
|
}
|
||||||
|
|
||||||
|
state Active {
|
||||||
|
[*] -> NumLockOff
|
||||||
|
NumLockOff --> NumLockOn : EvNumLockPressed
|
||||||
|
NumLockOn --> NumLockOff : EvNumLockPressed
|
||||||
|
--
|
||||||
|
[*] -> CapsLockOff
|
||||||
|
CapsLockOff --> CapsLockOn : EvCapsLockPressed
|
||||||
|
CapsLockOn --> CapsLockOff : EvCapsLockPressed
|
||||||
|
--
|
||||||
|
[*] -> ScrollLockOff
|
||||||
|
ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
|
||||||
|
ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
|
||||||
|
}
|
||||||
|
|
||||||
|
state \"Not Shooting State\" as NotShooting {
|
||||||
|
state \"Idle mode\" as Idle
|
||||||
|
state \"Configuring mode\" as Configuring
|
||||||
|
[*] --> Idle
|
||||||
|
Idle --> Configuring : EvConfig
|
||||||
|
Configuring --> Idle : EvConfig
|
||||||
|
}
|
||||||
|
"))
|
||||||
|
|
||||||
|
(provide 'plantuml-indentation-state-test)
|
||||||
|
|
||||||
|
;;; plantuml-indentation-state-test.el ends here
|
|
@ -1,4 +1,79 @@
|
||||||
/' This is a manual test for you to test different use-cases '/
|
/' This is a manual test for you to test different use-cases '/
|
||||||
|
|
||||||
|
participant API
|
||||||
|
participant Instance
|
||||||
|
|
||||||
|
alt deploy success
|
||||||
|
Instance -> API: Deploy successful
|
||||||
|
else deploy failure
|
||||||
|
Instance -> API: Deploy failed
|
||||||
|
else deploy timeout
|
||||||
|
Instance -> API: Deploy failed
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
package "kuaishow-common-proto" {
|
||||||
|
component Kwai
|
||||||
|
component KwaiGo
|
||||||
|
component AcFun
|
||||||
|
}
|
||||||
|
|
||||||
|
package "kwaigo-log-proto" {
|
||||||
|
[KwaiGo] ..> [KwaiGo Client->Data] : split
|
||||||
|
}
|
||||||
|
|
||||||
|
package "kwaigo-api-proto" {
|
||||||
|
[KwaiGo] ..> [KwaiGo Client->Server] : split
|
||||||
|
}
|
||||||
|
|
||||||
|
cloud "log server\n" {
|
||||||
|
[KwaiGo Client->Data] -->[KwaiGo Log Server] : upload
|
||||||
|
}
|
||||||
|
|
||||||
|
cloud "api server\n" {
|
||||||
|
[KwaiGo Api Server]
|
||||||
|
}
|
||||||
|
|
||||||
|
[KwaiGo Client->Server] --> [KwaiGo Api Server] : request
|
||||||
|
[KwaiGo Api Server] --> [KwaiGo Client->Server] : response
|
||||||
|
|
||||||
|
database "LogSql" {
|
||||||
|
folder "Log" {
|
||||||
|
[ReportEvent]
|
||||||
|
}
|
||||||
|
frame "event" {
|
||||||
|
[EventPackage]
|
||||||
|
}
|
||||||
|
|
||||||
|
frame "stat" {
|
||||||
|
[StatPackage]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[KwaiGo Log Server] --> [ReportEvent] : save
|
||||||
|
[ReportEvent] --> [EventPackage]
|
||||||
|
[ReportEvent] --> [StatPackage]
|
||||||
|
|
||||||
|
database "ApiSql" {
|
||||||
|
folder "kwaigo" {
|
||||||
|
[KwaiGoData]
|
||||||
|
}
|
||||||
|
frame "user" {
|
||||||
|
[UserData]
|
||||||
|
}
|
||||||
|
|
||||||
|
frame "photo" {
|
||||||
|
[PhotoData]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[KwaiGo Api Server] --> [KwaiGoData] : request
|
||||||
|
[KwaiGoData] --> [KwaiGo Api Server] : compute
|
||||||
|
|
||||||
|
[KwaiGoData] --> [UserData]
|
||||||
|
[KwaiGoData] --> [PhotoData]
|
||||||
|
|
||||||
|
|
||||||
Nobody -> [APIGateway]
|
Nobody -> [APIGateway]
|
||||||
|
|
||||||
package APackage {
|
package APackage {
|
||||||
|
|
|
@ -39,6 +39,33 @@
|
||||||
"Make the preview output as S more readable in test output."
|
"Make the preview output as S more readable in test output."
|
||||||
(concat "\n" s))
|
(concat "\n" s))
|
||||||
|
|
||||||
|
(defun plantuml-test-indent-block (before after)
|
||||||
|
"The common code for the block indentation tests.
|
||||||
|
|
||||||
|
BEFORE is the text block to be inserted into a temporary buffer.
|
||||||
|
AFTER is the expected text block after indentation.
|
||||||
|
|
||||||
|
The temporary buffer will be put into `plantuml-mode'. The whole buffer
|
||||||
|
will be indented with two spaces for each level of indentation.
|
||||||
|
|
||||||
|
Finally, the indented text in the buffer will be compared with AFTER."
|
||||||
|
|
||||||
|
(with-temp-buffer
|
||||||
|
;; fix the JAR location prior to mode initialization
|
||||||
|
;; for some reason, plantuml-mode disregards the setq-local
|
||||||
|
(setq-local plantuml-jar-path plantuml-test-jar-path)
|
||||||
|
(plantuml-init-once)
|
||||||
|
|
||||||
|
(insert before)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(plantuml-mode)
|
||||||
|
;; use 2 spaces instead of one tab for indentation
|
||||||
|
(setq-local indent-tabs-mode nil)
|
||||||
|
(setq-local tab-width 2)
|
||||||
|
|
||||||
|
(indent-region (point-min) (point-max))
|
||||||
|
(should (equal (buffer-string) after))))
|
||||||
|
|
||||||
;; enable code coverage
|
;; enable code coverage
|
||||||
(when (require 'undercover nil t)
|
(when (require 'undercover nil t)
|
||||||
(undercover "plantuml-mode.el"))
|
(undercover "plantuml-mode.el"))
|
||||||
|
|
Loading…
Reference in New Issue