ef4eecefae
* 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.
403 lines
7.8 KiB
EmacsLisp
403 lines
7.8 KiB
EmacsLisp
;;; 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
|