aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/stex/test.html
diff options
context:
space:
mode:
Diffstat (limited to 'imports/codemirror/mode/stex/test.html')
-rw-r--r--imports/codemirror/mode/stex/test.html251
1 files changed, 251 insertions, 0 deletions
diff --git a/imports/codemirror/mode/stex/test.html b/imports/codemirror/mode/stex/test.html
new file mode 100644
index 00000000..b53a6a24
--- /dev/null
+++ b/imports/codemirror/mode/stex/test.html
@@ -0,0 +1,251 @@
1<!doctype html>
2<html>
3 <head>
4 <title>CodeMirror: sTeX mode</title>
5 <link rel="stylesheet" href="../../lib/codemirror.css">
6 <script src="../../lib/codemirror.js"></script>
7 <script src="stex.js"></script>
8 <link rel="stylesheet" href="../../test/mode_test.css">
9 <script src="../../test/mode_test.js"></script>
10 <link rel="stylesheet" href="../../doc/docs.css">
11 </head>
12 <body>
13 <h1>Tests for the sTeX Mode</h1>
14 <h2>Basics</h2>
15 <script language="javascript">
16 MT = ModeTest;
17
18 MT.test('foo',
19 null, 'foo');
20
21 MT.test('foo bar',
22 null, 'foo',
23 null, ' bar');
24 </script>
25
26 <h2>Tags</h2>
27 <script language="javascript">
28 MT.test('\\begin{document}\n\\end{document}',
29 'tag', '\\begin',
30 'bracket', '{',
31 'atom', 'document',
32 'bracket', '}',
33 'tag', '\\end',
34 'bracket', '{',
35 'atom', 'document',
36 'bracket', '}');
37
38 MT.test('\\begin{equation}\n E=mc^2\n\\end{equation}',
39 'tag', '\\begin',
40 'bracket', '{',
41 'atom', 'equation',
42 'bracket', '}',
43 null, ' ',
44 null, ' ',
45 null, 'E',
46 null, '=mc',
47 null, '^2',
48 'tag', '\\end',
49 'bracket', '{',
50 'atom', 'equation',
51 'bracket', '}');
52
53 MT.test('\\begin{module}[]',
54 'tag', '\\begin',
55 'bracket', '{',
56 'atom', 'module',
57 'bracket', '}',
58 'bracket', '[',
59 'bracket', ']');
60
61 MT.test('\\begin{module}[id=bbt-size]',
62 'tag', '\\begin',
63 'bracket', '{',
64 'atom', 'module',
65 'bracket', '}',
66 'bracket', '[',
67 null, 'id',
68 null, '=bbt-size',
69 'bracket', ']');
70
71 MT.test('\\importmodule[b-b-t]{b-b-t}',
72 'tag', '\\importmodule',
73 'bracket', '[',
74 'string', 'b-b-t',
75 'bracket', ']',
76 'bracket', '{',
77 'builtin', 'b-b-t',
78 'bracket', '}');
79
80 MT.test('\\importmodule[\\KWARCslides{dmath/en/cardinality}]{card}',
81 'tag', '\\importmodule',
82 'bracket', '[',
83 'tag', '\\KWARCslides',
84 'bracket', '{',
85 'string', 'dmath',
86 'string', '/en',
87 'string', '/cardinality',
88 'bracket', '}',
89 'bracket', ']',
90 'bracket', '{',
91 'builtin', 'card',
92 'bracket', '}');
93
94 MT.test('\\PSforPDF[1]{#1}', // could treat #1 specially
95 'tag', '\\PSforPDF',
96 'bracket', '[',
97 'atom', '1',
98 'bracket', ']',
99 'bracket', '{',
100 null, '#1',
101 'bracket', '}');
102 </script>
103
104 <h2>Comments</h2>
105 <script language="javascript">
106 MT.test('% foo',
107 'comment', '%',
108 'comment', ' foo');
109
110 MT.test('\\item% bar',
111 'tag', '\\item',
112 'comment', '%',
113 'comment', ' bar');
114
115 MT.test(' % \\item',
116 null, ' ',
117 'comment', '%',
118 'comment', ' \\item');
119
120 MT.test('%\nfoo',
121 'comment', '%',
122 null, 'foo');
123 </script>
124
125 <h2>Errors</h2>
126 <script language="javascript">
127 MT.test('\\begin}{',
128 'tag', '\\begin',
129 'error', '}',
130 'bracket', '{');
131
132 MT.test('\\item]{',
133 'tag', '\\item',
134 'error', ']',
135 'bracket', '{');
136
137 MT.test('% }',
138 'comment', '%',
139 'comment', ' }');
140 </script>
141
142 <h2>Character Escapes</h2>
143 <script language="javascript">
144 MT.test('the \\# key',
145 null, 'the',
146 null, ' ',
147 'tag', '\\#',
148 null, ' key');
149
150 MT.test('a \\$5 stetson',
151 null, 'a',
152 null, ' ',
153 'tag', '\\$',
154 'atom', 5,
155 null, ' stetson');
156
157 MT.test('100\\% beef',
158 'atom', '100',
159 'tag', '\\%',
160 null, ' beef');
161
162 MT.test('L \\& N',
163 null, 'L',
164 null, ' ',
165 'tag', '\\&',
166 null, ' N');
167
168 MT.test('foo\\_bar',
169 null, 'foo',
170 'tag', '\\_',
171 null, 'bar');
172
173 MT.test('\\emph{\\{}',
174 'tag', '\\emph',
175 'bracket','{',
176 'tag', '\\{',
177 'bracket','}');
178
179 MT.test('\\emph{\\}}',
180 'tag', '\\emph',
181 'bracket','{',
182 'tag', '\\}',
183 'bracket','}');
184
185 MT.test('section \\S1',
186 null, 'section',
187 null, ' ',
188 'tag', '\\S',
189 'atom', '1');
190
191 MT.test('para \\P2',
192 null, 'para',
193 null, ' ',
194 'tag', '\\P',
195 'atom', '2');
196
197 </script>
198
199 <h2>Spacing control</h2>
200
201 <script language="javascript">
202 MT.test('x\\,y', // thinspace
203 null, 'x',
204 'tag', '\\,',
205 null, 'y');
206
207 MT.test('x\\;y', // thickspace
208 null, 'x',
209 'tag', '\\;',
210 null, 'y');
211
212 MT.test('x\\!y', // negative thinspace
213 null, 'x',
214 'tag', '\\!',
215 null, 'y');
216
217 MT.test('J.\\ L.\\ is', // period not ending a sentence
218 null, 'J',
219 null, '.',
220 null, '\\',
221 null, ' L',
222 null, '.',
223 null, '\\',
224 null, ' is'); // maybe could be better
225
226 MT.test('X\\@. The', // period ending a sentence
227 null, 'X',
228 'tag', '\\@',
229 null, '.',
230 null, ' The');
231
232 MT.test('{\\em If\\/} I', // italic correction
233 'bracket', '{',
234 'tag', '\\em',
235 null, ' ',
236 null, 'If',
237 'tag', '\\/',
238 'bracket', '}',
239 null, ' ',
240 null, 'I');