add indentation sequence diagram tests and mv basics tests to diagram tests

This commit is contained in:
René Schmelzer 2019-03-11 09:32:42 +01:00
parent cfaa374963
commit 1b3d7094c7
4 changed files with 341 additions and 327 deletions

View File

@ -258,332 +258,6 @@ foofoo|"
(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 platuml-test-block-indentation/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 plantuml-test-block-indentation/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/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/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.
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/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/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/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/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/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/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/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/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-basics-test)
;;; plantuml-indentation-basics-test.el ends here

View File

@ -313,8 +313,20 @@ together {
"))
(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/package-interface-nested ()
(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

View File

@ -314,6 +314,21 @@ endlegend
"))
(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
"
))
(provide 'plantuml-indentation-commons-test)
;;; plantuml-indentation-commons-test.el ends here

View File

@ -0,0 +1,313 @@
;;; 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 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