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.pull/89/head
parent
366ecb605a
commit
ef4eecefae
@ -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
|
@ -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 |