all repos — NoPaste @ 3e3c433f026c49e04d0efa0f0f39fc688ed32bb1

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/mscgen/mscgen_test.js (view raw)

 1// CodeMirror, copyright (c) by Marijn Haverbeke and others
 2// Distributed under an MIT license: https://codemirror.net/LICENSE
 3
 4(function() {
 5  var mode = CodeMirror.getMode({indentUnit: 2}, "mscgen");
 6  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
 7
 8  MT("empty chart",
 9     "[keyword msc][bracket {]",
10     "[base   ]",
11     "[bracket }]"
12   );
13
14  MT("comments",
15    "[comment // a single line comment]",
16    "[comment # another  single line comment /* and */ ignored here]",
17    "[comment /* A multi-line comment even though it contains]",
18    "[comment msc keywords and \"quoted text\"*/]");
19
20  MT("strings",
21    "[string \"// a string\"]",
22    "[string \"a string running over]",
23    "[string two lines\"]",
24    "[string \"with \\\"escaped quote\"]"
25  );
26
27  MT("xù/ msgenny keywords classify as 'base'",
28    "[base watermark]",
29    "[base wordwrapentities]",
30    "[base alt loop opt ref else break par seq assert]"
31  );
32
33  MT("xù/ msgenny constants classify as 'base'",
34    "[base auto]"
35  );
36
37  MT("mscgen constants classify as 'variable'",
38    "[variable true]", "[variable false]", "[variable on]", "[variable off]"
39  );
40
41  MT("mscgen options classify as keyword",
42    "[keyword hscale]", "[keyword width]", "[keyword arcgradient]", "[keyword wordwraparcs]"
43  );
44
45  MT("mscgen arcs classify as keyword",
46    "[keyword note]","[keyword abox]","[keyword rbox]","[keyword box]",
47    "[keyword |||...---]", "[keyword ..--==::]",
48    "[keyword ->]", "[keyword <-]", "[keyword <->]",
49    "[keyword =>]", "[keyword <=]", "[keyword <=>]",
50    "[keyword =>>]", "[keyword <<=]", "[keyword <<=>>]",
51    "[keyword >>]", "[keyword <<]", "[keyword <<>>]",
52    "[keyword -x]", "[keyword x-]", "[keyword -X]", "[keyword X-]",
53    "[keyword :>]", "[keyword <:]", "[keyword <:>]"
54  );
55
56  MT("within an attribute list, attributes classify as attribute",
57    "[bracket [[][attribute label]",
58    "[attribute id]","[attribute url]","[attribute idurl]",
59    "[attribute linecolor]","[attribute linecolour]","[attribute textcolor]","[attribute textcolour]","[attribute textbgcolor]","[attribute textbgcolour]",
60    "[attribute arclinecolor]","[attribute arclinecolour]","[attribute arctextcolor]","[attribute arctextcolour]","[attribute arctextbgcolor]","[attribute arctextbgcolour]",
61    "[attribute arcskip][bracket ]]]"
62  );
63
64  MT("outside an attribute list, attributes classify as base",
65    "[base label]",
66    "[base id]","[base url]","[base idurl]",
67    "[base linecolor]","[base linecolour]","[base textcolor]","[base textcolour]","[base textbgcolor]","[base textbgcolour]",
68    "[base arclinecolor]","[base arclinecolour]","[base arctextcolor]","[base arctextcolour]","[base arctextbgcolor]","[base arctextbgcolour]",
69    "[base arcskip]"
70  );
71
72  MT("a typical program",
73    "[comment # typical mscgen program]",
74    "[keyword msc][base  ][bracket {]",
75    "[keyword wordwraparcs][operator =][variable true][base , ][keyword hscale][operator =][string \"0.8\"][base , ][keyword arcgradient][operator =][base 30;]",
76    "[base   a][bracket [[][attribute label][operator =][string \"Entity A\"][bracket ]]][base ,]",
77    "[base   b][bracket [[][attribute label][operator =][string \"Entity B\"][bracket ]]][base ,]",
78    "[base   c][bracket [[][attribute label][operator =][string \"Entity C\"][bracket ]]][base ;]",
79    "[base   a ][keyword =>>][base  b][bracket [[][attribute label][operator =][string \"Hello entity B\"][bracket ]]][base ;]",
80    "[base   a ][keyword <<][base  b][bracket [[][attribute label][operator =][string \"Here's an answer dude!\"][bracket ]]][base ;]",
81    "[base   c ][keyword :>][base  *][bracket [[][attribute label][operator =][string \"What about me?\"][base , ][attribute textcolor][operator =][base red][bracket ]]][base ;]",
82    "[bracket }]"
83  );
84})();