Skip to content

Commit c6e4edf

Browse files
committed
Update tests
Signed-off-by: Jonas Dujava <[email protected]>
1 parent 7940474 commit c6e4edf

File tree

4 files changed

+222
-80
lines changed

4 files changed

+222
-80
lines changed

test/corpus/commands.txt

Lines changed: 161 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Command with one curly argument
2323
(source_file
2424
(generic_command
2525
(command_name)
26-
(curly_group
26+
(curly_group_generic_arg
2727
(text
2828
(word)))))
2929

@@ -38,11 +38,12 @@ Command with one curly argument and brackets
3838
(source_file
3939
(generic_command
4040
(command_name)
41-
(curly_group
41+
(curly_group_generic_arg
4242
(text
43-
(word))))
44-
(text
45-
(word)))
43+
(word)))
44+
(brack_group_generic_arg
45+
(text
46+
(word)))))
4647

4748
================================================================================
4849
Command with incomplete argument
@@ -65,6 +66,58 @@ Command with incomplete argument
6566
(text
6667
(word)))))))
6768

69+
================================================================================
70+
Command with mixed key-value arguments
71+
================================================================================
72+
73+
\hypersetup{
74+
unicode,
75+
linktoc=all,
76+
bookmarksnumbered,
77+
pdflinkmargin=1.0pt,
78+
citebordercolor=CiteColor,
79+
% colorlinks=true,
80+
pdfauthor=\ThesisAuthor,
81+
pdftitle=\ThesisTitle,
82+
}
83+
84+
--------------------------------------------------------------------------------
85+
86+
(source_file
87+
(generic_command
88+
(command_name)
89+
(curly_group_generic_arg
90+
(text
91+
(word))
92+
(key_value_pair
93+
(text
94+
(word))
95+
(text
96+
(word)))
97+
(text
98+
(word))
99+
(key_value_pair
100+
(text
101+
(word))
102+
(text
103+
(word)))
104+
(key_value_pair
105+
(text
106+
(word))
107+
(text
108+
(word)))
109+
(line_comment)
110+
(key_value_pair
111+
(text
112+
(word))
113+
(generic_command
114+
(command_name)))
115+
(key_value_pair
116+
(text
117+
(word))
118+
(generic_command
119+
(command_name))))))
120+
68121
================================================================================
69122
Acroynm definition
70123
================================================================================
@@ -79,10 +132,9 @@ Acroynm definition
79132
(key_value_pair
80133
(text
81134
(word))
82-
(value
83-
(curly_group
84-
(text
85-
(word))))))
135+
(curly_group
136+
(text
137+
(word)))))
86138
(curly_group_text
87139
(text
88140
(word)))
@@ -174,7 +226,7 @@ Command definition (xparse)
174226
Command definition with optional argument (xparse)
175227
================================================================================
176228

177-
\NewDocumentCommand{\foo}{o{default} m}{#1 #2}
229+
\NewDocumentCommand{\foo}{O{default} m}{#1 #2}
178230

179231
--------------------------------------------------------------------------------
180232

@@ -195,6 +247,105 @@ Command definition with optional argument (xparse)
195247
(placeholder)
196248
(placeholder)))))
197249

250+
================================================================================
251+
Command definition of complex command (xparse)
252+
================================================================================
253+
254+
\NewDocumentCommand{\cancel}{O{mygray}mo}{%
255+
\tikz[baseline=(N.base)]{
256+
\node[main node](N){\(#2\)};
257+
\IfValueT{#3}{\node[label node, gray, anchor=south] at (N.north){#3};}
258+
\draw[strike out, #1] (N.south west) -- (N.north east);
259+
}
260+
}
261+
262+
--------------------------------------------------------------------------------
263+
264+
(source_file
265+
(new_command_definition
266+
(curly_group_command_name
267+
(command_name))
268+
(curly_group_spec
269+
(text
270+
(word))
271+
(curly_group
272+
(text
273+
(word)))
274+
(text
275+
(word)))
276+
(curly_group
277+
(line_comment)
278+
(generic_command
279+
(command_name)
280+
(brack_group_generic_arg
281+
(key_value_pair
282+
(text
283+
(word))
284+
(text
285+
(word))))
286+
(curly_group_generic_arg
287+
(generic_command
288+
(command_name)
289+
(brack_group_generic_arg
290+
(text
291+
(word)
292+
(word))))
293+
(text
294+
(word))
295+
(curly_group
296+
(inline_formula
297+
(text
298+
(placeholder))))
299+
(text
300+
(word)
301+
(generic_command
302+
(command_name)
303+
(curly_group_generic_arg
304+
(text
305+
(placeholder)))
306+
(curly_group_generic_arg
307+
(generic_command
308+
(command_name)
309+
(brack_group_generic_arg
310+
(text
311+
(word)
312+
(word))
313+
(text
314+
(word))
315+
(key_value_pair
316+
(text
317+
(word))
318+
(text
319+
(word)))))
320+
(text
321+
(word))
322+
(text
323+
(word))
324+
(curly_group
325+
(text
326+
(placeholder)))
327+
(text
328+
(word))))
329+
(generic_command
330+
(command_name)
331+
(brack_group_generic_arg
332+
(text
333+
(word)
334+
(word))
335+
(text
336+
(placeholder)))))
337+
(text
338+
(word)
339+
(word))
340+
(text
341+
(operator)
342+
(operator))
343+
(text
344+
(word)
345+
(word))
346+
(text
347+
(word)))))))
348+
198349
================================================================================
199350
Author command
200351
================================================================================

test/corpus/environments.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Hello World!
4242
(curly_group_text
4343
(text
4444
(word)))
45-
(brack_group
45+
(brack_group_generic_arg
4646
(text
4747
(word)
4848
(word))))
@@ -72,7 +72,7 @@ Hello World!
7272
(curly_group_text
7373
(text
7474
(word)))
75-
(brack_group
75+
(brack_group_generic_arg
7676
(text
7777
(word))
7878
(brack_group
@@ -106,7 +106,7 @@ Hello World!
106106
(curly_group_text
107107
(text
108108
(word)))
109-
(brack_group
109+
(brack_group_generic_arg
110110
(curly_group)
111111
(curly_group)))
112112
(text
@@ -319,13 +319,13 @@ Math environment
319319
(text
320320
(word))))
321321
(text
322-
(word)
323-
(superscript
324-
(curly_group
325-
(text
326-
(word)
327-
(generic_command
328-
(command_name)))))
322+
(word)
323+
(superscript
324+
(curly_group
325+
(text
326+
(word)
327+
(generic_command
328+
(command_name)))))
329329
(operator)
330330
(word))
331331
(text

test/corpus/includes.txt

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,17 @@ Package include with options
3535

3636
(source_file
3737
(package_include
38-
(brack_group_key_value
38+
(brack_group_generic_arg
3939
(key_value_pair
4040
(text
4141
(word))
42-
(value
43-
(text
44-
(word)
45-
(generic_command
46-
(command_name)))))
47-
(key_value_pair
4842
(text
4943
(word)
50-
(word))))
44+
(generic_command
45+
(command_name))))
46+
(text
47+
(word)
48+
(word)))
5149
(curly_group_path_list
5250
(path))))
5351

@@ -91,19 +89,17 @@ Class include with options
9189

9290
(source_file
9391
(class_include
94-
(brack_group_key_value
92+
(brack_group_generic_arg
9593
(key_value_pair
9694
(text
9795
(word))
98-
(value
99-
(text
100-
(word)
101-
(generic_command
102-
(command_name)))))
103-
(key_value_pair
10496
(text
10597
(word)
106-
(word))))
98+
(generic_command
99+
(command_name))))
100+
(text
101+
(word)
102+
(word)))
107103
(curly_group_path
108104
(path))))
109105

@@ -141,10 +137,9 @@ BibLaTeX glob include
141137

142138
(source_file
143139
(biblatex_include
144-
(brack_group_key_value
145-
(key_value_pair
146-
(text
147-
(word))))
140+
(brack_group_generic_arg
141+
(text
142+
(word)))
148143
(curly_group_glob_pattern
149144
(glob_pattern))))
150145

@@ -171,18 +166,16 @@ Graphics include with options
171166

172167
(source_file
173168
(graphics_include
174-
(brack_group_key_value
169+
(brack_group_generic_arg
175170
(key_value_pair
176171
(text
177172
(word))
178-
(value
179-
(text
180-
(word))))
173+
(text
174+
(word)))
181175
(key_value_pair
182176
(text
183177
(word))
184-
(value
185-
(text
186-
(word)))))
178+
(text
179+
(word))))
187180
(curly_group_path
188181
(path))))

0 commit comments

Comments
 (0)