vesti 0.13.1

A preprocessor that compiles into LaTeX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
#![allow(clippy::needless_raw_string_hashes)]

use super::*;
use crate::codegen::make_latex_format;
use crate::commands::LatexEngineType;

macro_rules! expected {
    ($source: ident should be $expected: ident) => {{
        let mut parser = Parser::new(Lexer::new($source), true, false);
        assert_eq!(
            $expected,
            make_latex_format::<true>(&mut parser, LatexEngineType::Invalid).unwrap()
        );
    }};
}

#[test]
fn test_parse_docclass() {
    let source1 = "docclass article";
    let source2 = "docclass standalone (tikz)";
    let source3 = "docclass standalone ( tikz  )";
    let source4 = "docclass coprime (korean, tikz, tcolorbox)";
    let source5 = r#"docclass coprime (
    korean,
    tikz,
    tcolorbox
)"#;
    let source6 = r#"docclass coprime (
    korean,
    tikz,
    tcolorbox,
)"#;

    let expected1 = "\\documentclass{article}\n";
    let expected2 = "\\documentclass[tikz]{standalone}\n";
    let expected3 = "\\documentclass[korean,tikz,tcolorbox]{coprime}\n";

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
    expected!(source3 should be expected2);
    expected!(source4 should be expected3);
    expected!(source5 should be expected3);
    expected!(source6 should be expected3);
}

#[test]
fn test_parse_usepackage() {
    let source1 = "importpkg kotex";
    let source2 = "importpkg tcolorbox (many)";
    let source3 = "importpkg tcolorbox ( many )";
    let source4 = "importpkg foo (bar1, bar2)";
    let source5 = "importpkg geometry (a4paper, margin = 0.4in)";
    let source6 = r#"importpkg {
        kotex,
        tcolorbox (many),
        foo (bar1, bar2, bar3),
        geometry (a4paper, margin = 0.4in),
    }"#;
    let source7 = r#"importpkg {
        kotex,
        tcolorbox (many),
        foo (
          bar1, bar2,
          bar3
        ),
        geometry (a4paper, margin = 0.4in),
    }"#;
    let source8 = r#"importpkg {
        kotex,
        tcolorbox (many),
        foo (
          bar1,
          bar2,
          bar3,
        ),
        geometry (a4paper, margin = 0.4in),
    }"#;
    let expected1 = "\\usepackage{kotex}\n";
    let expected2 = "\\usepackage[many]{tcolorbox}\n";
    let expected3 = "\\usepackage[bar1,bar2]{foo}\n";
    let expected4 = "\\usepackage[a4paper,margin=0.4in]{geometry}\n";
    let expected5 = r#"\usepackage{kotex}
\usepackage[many]{tcolorbox}
\usepackage[bar1,bar2,bar3]{foo}
\usepackage[a4paper,margin=0.4in]{geometry}
"#;

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
    expected!(source3 should be expected2);
    expected!(source4 should be expected3);
    expected!(source5 should be expected4);
    expected!(source6 should be expected5);
    expected!(source7 should be expected5);
    expected!(source8 should be expected5);
}

#[test]
fn parse_main_string() {
    let source1 = "startdoc This is vesti";
    let source2 = "startdoc docclass";

    let expected1 = "\\begin{document}\nThis is vesti\n\\end{document}\n";
    let expected2 = "\\begin{document}\ndocclass\n\\end{document}\n";

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
}

#[test]
fn parse_environment() {
    let source1 = r#"startdoc useenv center {
    The Document.
}"#;
    let source2 = r#"startdoc useenv minipage (0.7\pagewidth) {
    The Document.
}"#;
    let source3 = r#"startdoc useenv minipage(0.7\pagewidth) {
    The Document.
}"#;
    let source4 = r#"startdoc useenv figure [ht] {
    The Document.
}"#;
    let source5 = r#"startdoc useenv foo (bar1)[bar2](bar3)(bar4)[bar5] {
    The Document.
}"#;
    let source6 = r#"startdoc useenv foo* (bar1)(bar2) {
    The Document.
}"#;
    let source7 = r#"startdoc useenv foo *(bar1)(bar2) {
    The Document.
}"#;

    let expected1 = r#"\begin{document}
\begin{center}
    The Document.
\end{center}

\end{document}
"#;
    let expected2 = r#"\begin{document}
\begin{minipage}{0.7\pagewidth}
    The Document.
\end{minipage}

\end{document}
"#;
    let expected3 = r#"\begin{document}
\begin{figure}[ht]
    The Document.
\end{figure}

\end{document}
"#;
    let expected4 = r#"\begin{document}
\begin{foo}{bar1}[bar2]{bar3}{bar4}[bar5]
    The Document.
\end{foo}

\end{document}
"#;
    let expected5 = r#"\begin{document}
\begin{foo*}{bar1}{bar2}
    The Document.
\end{foo*}

\end{document}
"#;
    let expected6 = r#"\begin{document}
\begin{foo}*{bar1}{bar2}
    The Document.
\end{foo}

\end{document}
"#;

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
    expected!(source3 should be expected2);
    expected!(source4 should be expected3);
    expected!(source5 should be expected4);
    expected!(source6 should be expected5);
    expected!(source7 should be expected6);
}

#[test]
fn parse_latex_functions() {
    let source1 = "startdoc \\foo";
    let source2 = "startdoc \\foo{bar1}";
    let source3 = "startdoc \\foo[bar1]";
    let source4 = "startdoc \\foo{bar1}[bar2]";
    let source5 = "startdoc \\foo*[bar1]{bar2}{bar3}";
    let source6 = "startdoc \\foo*{bar1}{bar2}";
    let source7 = "startdoc \\foo[bar3][bar2][bar1]{bar4}{bar5}{bar6}{bar7}";
    let source8 = "startdoc \\foo*[bar1]{bar2}**{bar3}";
    let source9 = r#"startdoc \textbf{
    Hallo!\TeX and \foo{bar1}{bar2{a}{}}; today}"#;

    let expected1 = r#"\begin{document}
\foo
\end{document}
"#;
    let expected2 = r#"\begin{document}
\foo{bar1}
\end{document}
"#;
    let expected3 = r#"\begin{document}
\foo[bar1]
\end{document}
"#;
    let expected4 = r#"\begin{document}
\foo{bar1}[bar2]
\end{document}
"#;
    let expected5 = r#"\begin{document}
\foo*[bar1]{bar2}{bar3}
\end{document}
"#;
    let expected6 = r#"\begin{document}
\foo*{bar1}{bar2}
\end{document}
"#;
    let expected7 = r#"\begin{document}
\foo[bar3][bar2][bar1]{bar4}{bar5}{bar6}{bar7}
\end{document}
"#;
    let expected8 = r#"\begin{document}
\foo*[bar1]{bar2}**{bar3}
\end{document}
"#;
    let expected9 = r#"\begin{document}
\textbf{
    Hallo!\TeX and \foo{bar1}{bar2{a}{}}; today}
\end{document}
"#;

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
    expected!(source3 should be expected3);
    expected!(source4 should be expected4);
    expected!(source5 should be expected5);
    expected!(source6 should be expected6);
    expected!(source7 should be expected7);
    expected!(source8 should be expected8);
    expected!(source9 should be expected9);
}

#[test]
fn test_parse_math_stmt() {
    let source1 = "startdoc $\\sum_1^\\infty f(x)$";
    let source2 = "startdoc \\[\\sum_1^\\infty f(x)\\]";

    let expected1 = r#"\begin{document}
$\sum_1^\infty f(x)$
\end{document}
"#;
    let expected2 = r#"\begin{document}
\[\sum_1^\infty f(x)\]
\end{document}
"#;

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
}

#[test]
fn test_other_character() {
    let source1 = "これて、何ですか?";

    expected!(source1 should be source1);
}

#[test]
fn test_brace() {
    let source1 = "${\nabcd\n}$";
    let source2 = "$\\sum_{j=1}$";

    expected!(source1 should be source1);
    expected!(source2 should be source2);
}

#[test]
fn test_fraction() {
    let source1 = "${1//2}$";
    let source2 = "${\\alpha+\\beta//c+d-e}$";

    let expected1 = "$\\frac{1}{2}$";
    let expected2 = "$\\frac{\\alpha+\\beta}{c+d-e}$";

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
}

#[test]
fn test_complicated_fraction() {
    let source = "${{2//3}+\\alpha//5-{x+y//c-d}}$";
    let expected = "$\\frac{\\frac{2}{3}+\\alpha}{5-\\frac{x+y}{c-d}}$";

    expected!(source should be expected);
}

#[test]
fn test_parse_function_definition_basic() {
    let source1 = "defun foo (#1) \\overline{#1} enddef";
    let source2 = "defun foo(#1) \\overline{#1} enddef";
    let source3 = "defun foo (#1)\\overline{#1} enddef";
    let source4 = "defun foo(#1)\\overline{#1} enddef";
    let source5 = r#"defun foo (#1)
        \overline{#1}
enddef"#;
    let source6 = r#"defun foo(#1)
        \overline{#1}
enddef"#;

    let expected = "\\def\\foo#1{%\n\\overline{#1}%\n}\n";

    expected!(source1 should be expected);
    expected!(source2 should be expected);
    expected!(source3 should be expected);
    expected!(source4 should be expected);
    expected!(source5 should be expected);
    expected!(source6 should be expected);
}

#[test]
fn test_parse_function_definition_name() {
    let source1 = "defun bar_foo (#1#2) \\overline{#1} and #2 enddef";
    let source2 = "defun bar_foo(#1#2) \\overline{#1} and #2 enddef";
    let source3 = "defun bar_foo (#1#2)\\overline{#1} and #2 enddef";
    let source4 = "defun bar_foo(#1#2)\\overline{#1} and #2 enddef";
    let source5 = r#"defun bar_foo (#1#2)
        \overline{#1} and #2
enddef"#;
    let source6 = r#"defun bar_foo(#1#2)
        \overline{#1} and #2
enddef"#;

    let expected = "\\def\\bar@foo#1#2{%\n\\overline{#1} and #2%\n}\n";

    expected!(source1 should be expected);
    expected!(source2 should be expected);
    expected!(source3 should be expected);
    expected!(source4 should be expected);
    expected!(source5 should be expected);
    expected!(source6 should be expected);
}

#[test]
fn test_parse_function_definition_arguments() {
    let source1 = "defun barfoo (import #1 and #2) \\overline{#1} and #2 enddef";
    let source2 = "defun barfoo(import #1 and #2) \\overline{#1} and #2 enddef";
    let source3 = "defun barfoo (import #1 and #2)\\overline{#1} and #2 enddef";
    let source4 = "defun barfoo(import #1 and #2)\\overline{#1} and #2 enddef";
    let source5 = r#"defun barfoo (import #1 and #2)
        \overline{#1} and #2
enddef"#;
    let source6 = r#"defun barfoo(import #1 and #2)
        \overline{#1} and #2
enddef"#;

    let expected = "\\def\\barfoo import #1 and #2{%\n\\overline{#1} and #2%\n}\n";

    expected!(source1 should be expected);
    expected!(source2 should be expected);
    expected!(source3 should be expected);
    expected!(source4 should be expected);
    expected!(source5 should be expected);
    expected!(source6 should be expected);
}

#[test]
fn test_parse_function_definition_kind() {
    let source1 = "defun foo(#1\\over#2) bar enddef";
    let source2 = "ldefun foo(#1\\over#2) bar enddef";
    let source3 = "odefun foo(#1\\over#2) bar enddef";
    let source4 = "lodefun foo(#1\\over#2) bar enddef";
    let source5 = "edefun foo(#1\\over#2) bar enddef";
    let source6 = "ledefun foo(#1\\over#2) bar enddef";
    let source7 = "oedefun foo(#1\\over#2) bar enddef";
    let source8 = "loedefun foo(#1\\over#2) bar enddef";
    let source9 = "gdefun foo(#1\\over#2) bar enddef";
    let source10 = "lgdefun foo(#1\\over#2) bar enddef";
    let source11 = "ogdefun foo(#1\\over#2) bar enddef";
    let source12 = "logdefun foo(#1\\over#2) bar enddef";
    let source13 = "xdefun foo(#1\\over#2) bar enddef";
    let source14 = "lxdefun foo(#1\\over#2) bar enddef";
    let source15 = "oxdefun foo(#1\\over#2) bar enddef";
    let source16 = "loxdefun foo(#1\\over#2) bar enddef";

    let expected1 = "\\def\\foo#1\\over#2{%\nbar%\n}\n";
    let expected2 = "\\long\\def\\foo#1\\over#2{%\nbar%\n}\n";
    let expected3 = "\\outer\\def\\foo#1\\over#2{%\nbar%\n}\n";
    let expected4 = "\\long\\outer\\def\\foo#1\\over#2{%\nbar%\n}\n";
    let expected5 = "\\edef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected6 = "\\long\\edef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected7 = "\\outer\\edef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected8 = "\\long\\outer\\edef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected9 = "\\gdef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected10 = "\\long\\gdef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected11 = "\\outer\\gdef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected12 = "\\long\\outer\\gdef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected13 = "\\xdef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected14 = "\\long\\xdef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected15 = "\\outer\\xdef\\foo#1\\over#2{%\nbar%\n}\n";
    let expected16 = "\\long\\outer\\xdef\\foo#1\\over#2{%\nbar%\n}\n";

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
    expected!(source3 should be expected3);
    expected!(source4 should be expected4);
    expected!(source5 should be expected5);
    expected!(source6 should be expected6);
    expected!(source7 should be expected7);
    expected!(source8 should be expected8);
    expected!(source9 should be expected9);
    expected!(source10 should be expected10);
    expected!(source11 should be expected11);
    expected!(source12 should be expected12);
    expected!(source13 should be expected13);
    expected!(source14 should be expected14);
    expected!(source15 should be expected15);
    expected!(source16 should be expected16);
}

#[test]
fn test_parse_function_definition_trim() {
    let source1_trim_both = "defun foo (#1) \\overline{#1} enddef";
    let source2_trim_both = "defun foo (#1)\\overline{#1} enddef";
    let source3_trim_both = "defun foo (#1) \\overline{#1}enddef";
    let source4_trim_both = "defun foo (#1)\\overline{#1}enddef";

    let source1_trim_left = "defun foo (#1) \\overline{#1} enddef*";
    let source2_trim_left = "defun foo (#1)\\overline{#1} enddef*";
    let source3_trim_left = "defun foo (#1) \\overline{#1}enddef*";
    let source4_trim_left = "defun foo (#1)\\overline{#1}enddef*";

    let source1_trim_right = "defun* foo (#1) \\overline{#1} enddef";
    let source2_trim_right = "defun* foo (#1)\\overline{#1} enddef";
    let source3_trim_right = "defun* foo (#1) \\overline{#1}enddef";
    let source4_trim_right = "defun* foo (#1)\\overline{#1}enddef";

    let source1_no_trim = "defun* foo (#1) \\overline{#1} enddef*";
    let source2_no_trim = "defun* foo (#1)\\overline{#1} enddef*";
    let source3_no_trim = "defun* foo (#1) \\overline{#1}enddef*";
    let source4_no_trim = "defun* foo (#1)\\overline{#1}enddef*";

    let case1 = "\\def\\foo#1{%\n\\overline{#1}%\n}\n";
    let case2 = "\\def\\foo#1{%\n\\overline{#1} %\n}\n";
    let case3 = "\\def\\foo#1{\\overline{#1}%\n}\n";
    let case4 = "\\def\\foo#1{ \\overline{#1}%\n}\n";
    let case5 = "\\def\\foo#1{\\overline{#1} %\n}\n";
    let case6 = "\\def\\foo#1{ \\overline{#1} %\n}\n";

    // Check trim_both
    expected!(source1_trim_both should be case1);
    expected!(source2_trim_both should be case1);
    expected!(source3_trim_both should be case1);
    expected!(source4_trim_both should be case1);

    // Check trim_left
    expected!(source1_trim_left should be case2);
    expected!(source2_trim_left should be case2);
    expected!(source3_trim_left should be case1);
    expected!(source4_trim_left should be case1);

    // Check trim_right
    expected!(source1_trim_right should be case4);
    expected!(source2_trim_right should be case3);
    expected!(source3_trim_right should be case4);
    expected!(source4_trim_right should be case3);

    // Check no_trim
    expected!(source1_no_trim should be case6);
    expected!(source2_no_trim should be case5);
    expected!(source3_no_trim should be case4);
    expected!(source4_no_trim should be case3);
}

#[test]
fn test_parse_define_environment() {
    let source = r#"defenv foo
\vskip 1pc\noindent
endswith
\vskip 1pc
enddef
"#;
    let expected = "\\newenvironment{foo}{\\vskip 1pc\\noindent}{\\vskip 1pc}\n";

    expected!(source should be expected);
}

#[test]
fn test_parse_define_environment_with_argument() {
    let source = r#"defenv foo [1]
\vskip 1pc\noindent #1
endswith
\vskip 1pc
enddef
"#;
    let expected = "\\newenvironment{foo}[1]{\\vskip 1pc\\noindent #1}{\\vskip 1pc}\n";

    expected!(source should be expected);
}

#[test]
fn test_parse_define_environment_with_optional_argument() {
    let source1 = r#"defenv foo [1,basd]
\vskip 1pc\noindent #1
endswith
\vskip 1pc
enddef
"#;
    let source2 = r#"defenv foo [1, basd]
\vskip 1pc\noindent #1
endswith
\vskip 1pc
enddef
"#;
    let source3 = r#"defenv foo [1,  basd]
\vskip 1pc\noindent #1
endswith
\vskip 1pc
enddef
"#;

    let expected1 = "\\newenvironment{foo}[1][basd]{\\vskip 1pc\\noindent #1}{\\vskip 1pc}\n";
    let expected2 = "\\newenvironment{foo}[1][ basd]{\\vskip 1pc\\noindent #1}{\\vskip 1pc}\n";

    expected!(source1 should be expected1);
    expected!(source2 should be expected1);
    expected!(source3 should be expected2);
}

#[test]
fn parse_nested_define_environment() {
    let source = r#"defenv* foo [1,basd]
  defenv bar
      give a number
  endswith
      and foo
  enddef
begenv* bar
  \noindent #1
endenv bar
endswith*
\vskip 1pc
enddef"#;

    let expected = r#"\newenvironment{foo}[1][basd]{
  \newenvironment{bar}{give a number}{and foo}
\begin{bar}
  \noindent #1
\end{bar}
}{
\vskip 1pc}
"#;
    expected!(source should be expected);
}

#[test]
fn parse_phantom_environment() {
    let source = r#"defenv newminipage [1]
    begenv minipage (0.4\textwidth)
endswith
    endenv minipage
enddef"#;

    let expected =
        "\\newenvironment{newminipage}[1]{\\begin{minipage}{0.4\\textwidth}}{\\end{minipage}}\n";
    expected!(source should be expected);
}

#[test]
fn parse_math_delimiters() {
    let source1 = "$?)?(?@}?\\}?|?||$";
    let source2 = "$(?)?{@?\\{?|?||?$";

    let expected1 = "$\\left)\\left(\\left\\rangle \\left\\}\\left|\\left\\|$";
    let expected2 = "$\\right(\\right)\\right\\langle \\right\\{\\right|\\right\\|$";

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
}

#[test]
fn parse_text_in_math() {
    let source1 = "$\"foo\"$";
    let source2 = "$#\"foo\"$";
    let source3 = "$\"foo\"#$";
    let source4 = "$#\"foo\"#$";

    let expected1 = "$\\text{ foo }$";
    let expected2 = "$\\text{foo }$";
    let expected3 = "$\\text{ foo}$";
    let expected4 = "$\\text{foo}$";

    expected!(source1 should be expected1);
    expected!(source2 should be expected2);
    expected!(source3 should be expected3);
    expected!(source4 should be expected4);
}

// Actual bugs encountered in previous versions

#[test]
fn parsing_bug_fix001() {
    let source = r#"
makeatletter
defun ps_solution()
    \let\_oddfoot=\_empty\let\_evenfoot=\_empty
    defun _oddhead() \the\titlename\hfill\thepage enddef
    defun _evenhead() \thepage\hfill\the\titlename enddef
enddef
makeatother
"#;
    let expected = r#"
\makeatletter
\def\ps@solution{%
\let\@oddfoot=\@empty\let\@evenfoot=\@empty
    \def\@oddhead{%
\the\titlename\hfill\thepage%
}
    \def\@evenhead{%
\thepage\hfill\the\titlename%
}%
}
\makeatother
"#;
    expected!(source should be expected);
}

#[test]
// This example shows that vesti prefer to use "..." syntax in math instead of
// using raw \text LaTeX command.
fn parsing_bug_fix002() {
    let source = "$oo\\text{oo}$ oo $oo\"oo\"$";
    let expected = r"$\infty \text{\infty }$ oo $\infty \text{ oo }$";

    expected!(source should be expected);
}

#[test]
// Below example shows the reason to change the syntax of \left and \right pair
fn parsing_bug_fix003() {
    let source = "$?(it\\lambda?(b-\\int)?)?$";
    let expected = r"$\left(it\lambda\left(b-\int\right)\right)$";

    expected!(source should be expected);
}