120 lines
2.8 KiB
EmacsLisp
120 lines
2.8 KiB
EmacsLisp
|
;;; 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
|