From 1cd687b681224a6a190fea5d542b92f147f9abf0 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 13 Jan 2021 16:37:18 +0100 Subject: [PATCH] =?UTF-8?q?Move=20escaping=20tests=20to=20integration=20an?= =?UTF-8?q?d=20extend=20them=20=F0=9F=9A=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/parse/tests.rs | 17 ----------------- src/parse/tokens.rs | 15 ++++++++------- tests/ref/escaping.png | Bin 0 -> 4320 bytes tests/ref/headings.png | Bin 7991 -> 8197 bytes tests/typ/escaping.typ | 32 ++++++++++++++++++++++++++++++++ tests/typ/headings.typ | 4 +++- tests/typeset.rs | 4 ++-- 7 files changed, 45 insertions(+), 27 deletions(-) create mode 100644 tests/ref/escaping.png create mode 100644 tests/typ/escaping.typ diff --git a/src/parse/tests.rs b/src/parse/tests.rs index f8b9dcbb1..9a0a4ce6d 100644 --- a/src/parse/tests.rs +++ b/src/parse/tests.rs @@ -251,23 +251,6 @@ fn test_parse_raw() { errors: [S(8..8, "expected backtick(s)")]); } -#[test] -fn test_parse_escape_sequences() { - // Basic, mostly tested in tokenizer. - t!(r"\[" Text("[")); - t!(r"\u{1F3D5}" nodes: [S(0..9, Text("🏕"))], spans: true); - - // Bad value. - t!(r"\u{FFFFFF}" - nodes: [Text(r"\u{FFFFFF}")], - errors: [S(0..10, "invalid unicode escape sequence")]); - - // No closing brace. - t!(r"\u{41*" - nodes: [Text("A"), Strong], - errors: [S(5..5, "expected closing brace")]); -} - #[test] fn test_parse_groups() { // Test paren group. diff --git a/src/parse/tokens.rs b/src/parse/tokens.rs index 7741d27f8..85fc49780 100644 --- a/src/parse/tokens.rs +++ b/src/parse/tokens.rs @@ -179,7 +179,7 @@ impl<'s> Tokens<'s> { // Parenthesis. '[' | ']' | '{' | '}' => true, // Markup. - '*' | '_' | '#' | '~' | '`' => true, + '*' | '_' | '#' | '~' | '`' | '$' => true, // Escaping. '\\' => true, _ => false, @@ -279,7 +279,7 @@ impl<'s> Tokens<'s> { // Parenthesis. '[' | ']' | '{' | '}' | // Markup. - '*' | '_' | '~' | '#' | '`' => { + '*' | '_' | '#' | '~' | '`' | '$' => { let start = self.s.index(); self.s.eat_assert(c); Token::Text(&self.s.eaten_from(start)) @@ -447,19 +447,19 @@ mod tests { use Token::{Ident, *}; use TokenMode::{Code, Markup}; - fn Raw(text: &str, backticks: usize, terminated: bool) -> Token { + const fn Raw(text: &str, backticks: usize, terminated: bool) -> Token { Token::Raw(TokenRaw { text, backticks, terminated }) } - fn Math(formula: &str, inline: bool, terminated: bool) -> Token { + const fn Math(formula: &str, inline: bool, terminated: bool) -> Token { Token::Math(TokenMath { formula, inline, terminated }) } - fn UnicodeEscape(sequence: &str, terminated: bool) -> Token { + const fn UnicodeEscape(sequence: &str, terminated: bool) -> Token { Token::UnicodeEscape(TokenUnicodeEscape { sequence, terminated }) } - fn Str(string: &str, terminated: bool) -> Token { + const fn Str(string: &str, terminated: bool) -> Token { Token::Str(TokenStr { string, terminated }) } @@ -505,7 +505,7 @@ mod tests { ('/', None, "//", LineComment("")), ('/', None, "/**/", BlockComment("")), ('/', Some(Markup), "*", Star), - ('/', Some(Markup), "_", Underscore), + ('/', Some(Markup), "$ $", Math(" ", true, true)), ('/', Some(Markup), r"\\", Text(r"\")), ('/', Some(Markup), "#let", Let), ('/', Some(Code), "(", LeftParen), @@ -740,6 +740,7 @@ mod tests { t!(Markup: r"\#" => Text("#")); t!(Markup: r"\~" => Text("~")); t!(Markup: r"\`" => Text("`")); + t!(Markup: r"\$" => Text("$")); // Test unescapable symbols. t!(Markup[" /"]: r"\a" => Text(r"\"), Text("a")); diff --git a/tests/ref/escaping.png b/tests/ref/escaping.png new file mode 100644 index 0000000000000000000000000000000000000000..fedd3e5882711f939620523cdfd20f0c79d16ae7 GIT binary patch literal 4320 zcmb_g2T;?^w*Myt2uev15D+BkP%yQ&d%(dJu`cD_w4Wd&c+xUX|tW+KLG#$ zo34(Q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zS)6iDAMfB|9C=ijAy7DFPbZ+|4Myb@Z zBu>17q^2o^fgm5Eb6du^^-U4=rvavQ^;F zOZ?Q+J_mw-j>FUl-X33G-E3DK8X;xIXt%{l-KtQl^bEqu5d1UT8YTDyS&p+IKQ;Gp z!(GRsAV&#%RJebR3}SSpaNMf@4>ICkuoo>v%T=a(0q7#)QVJntKEt^Cg5NRVNKz ztfxg(IBc!65{V}o$B49A*7JjTfB)*81Fh|`XCIpS)opTk`}|7Cecw;9Qc3`YSl5RQ_;&17oB;;%$sNq*Ai(E z(Rcx*AG?QxFZ2@sf`^JTR~aOno3~{H)s3Ay!Qw+th}GeQX^A|(fquKNWdy=#85LNR zAVCvi?37I_rD&1a0VhtlZob)5B)bY6uA5|`>C#!BCX!|z&`~tUC|b^=n=XB5mdhM0 z=@9&LBu{55es%P>9N@oexg(aAz`aXKzji*CjZ9=YE6Mnwj!EP<_%pJBc1=^(9QsbE z;u#}`Z&T$P0Mo`i{bwUFTS>>Ap)(i?Gs(S4pD($0==XU^&lY_saDF@iTM6z#JQw)dFZ_&p`RvX?3c{Zj@{L zqVMDj&$9_~k7O3(r0K9k(S6O;|C)QRB({`<-|UI)HbDbaB16*mKZ{W}rMt&g z4P!}6=rs1xSF_i}!4Be}%8fVup&y1u75Q7nV;-6uZP_GU1n10O%;^I#-E$jLJEk;~ zs{J69##mhH=Oq6eez@+zfQA@-eRES}P~3!AJ2xSUMEV7DLjW`fP%h~AbNv&z+4XS6 zh7izwjqVMO?q;`_61Qcr&nOGSmGM}92c&8U>QJL+p7c3lSI3$s@gAM q=KoJk|DWIk|9gqBf67eqsw%c1;kF8M^UJ@#E_BgGTICvc;r{@Mkf2@w literal 0 HcmV?d00001 diff --git a/tests/ref/headings.png b/tests/ref/headings.png index b16e38a6bad4b354913343738524a72e20a56b4d..3deecf8f3900fc2674856157507985eafe51b445 100644 GIT binary patch delta 7380 zcmX|mdpOho`~S-flS5MxF$__eLn@i$nuLT(iiD9vVl0HhW(+ycArhe^B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NIlf|V#(eVy&D%RT4&^WX^)vwf>Q3+j|7+u-+7amBdOL8~?E_thxk z^`=1U&Da+L@{9#81@ybAF}s(2G|%re4W}7@b-b9(n3ybpyk+@k)Q49gQNBPDj3_Jh;*I z0HUJExqb-2em3Qi$C^uF`|7sr^n*|Xg5|wSCTLTS#ztF|LYRsDKsm8|U`6q|*?oRg zLs4z?$=0F2EA@4h$rzXQE3&IDl4u~%ZBg*MtEB1SyG35Xqp!MMJny3nX=NqBM`svC zeEr`hzdpdQsr&ZQ;;67qDqsX(r+R8g_#^npg-{JxPWNefT=<9LXO~$w@GyyM$*-0l zxtQdo$+jH{ieF#7LUX$qYnpTI%mq=#rAyK5zBJ+F->|`HmB-|<$N?t~7qKb$ixfev z+JBKaC6r(Vf7K`uyL9R`c0N6cGF$r?yR5@pYlU&aRVA2GPdOgTg5FskP=;aB$qA2_ z-TT5D43Y7)Rkd)<5qNNxbgcRZS9jsH_JF3X@IX+P`kYO4+&$%*=jUDbqBl*Jr%iI1 zDuUr@zh`Ar?hkmoF$LEI<5$5&N|?FOB&4;jpXsM&NkinTUyp^15~o4H*i{@1{zBY< zTa#aKpb1ehfE-S&M30meIJ`idkg;U8oD!{n>@&2{Rhnh*6kD#3Fx-s+r_HhCk&J6342n(~NdzPQFffHRfG`spy9~t$308`AhC;$Ke diff --git a/tests/typ/escaping.typ b/tests/typ/escaping.typ new file mode 100644 index 000000000..a562dcc0c --- /dev/null +++ b/tests/typ/escaping.typ @@ -0,0 +1,32 @@ +// Test basic symbol escapes. + +// Escapable +\\ \/ \[ \] \{ \} \* \_ \# \~ \` \$ + +// No need to escape. +( ) = ; + +// Unescapable. +\a \: \; \( \) + +// Escaped comments. +\// +\/\* \*\/ +\/* \*/ + +--- +// Test unicode escapes. +// +// error: 5:1-5:11 invalid unicode escape sequence +// error: 8:6-8:6 expected closing brace + +\u{1F3D5} == 🏕 + +// Bad sequence. +\u{FFFFFF} + +// Missing closing brace. +\u{41*Bold* + +// Escaped escape sequence. +\\u\{ABC\} diff --git a/tests/typ/headings.typ b/tests/typ/headings.typ index 88c76ad38..3a1157462 100644 --- a/tests/typ/headings.typ +++ b/tests/typ/headings.typ @@ -17,12 +17,14 @@ --- // Is no heading. // -// error: 4:1-4:6 unexpected invalid token +// error: 8:1-8:6 unexpected invalid token \# No heading Text with # hashtag +Nr#1 + #nope --- diff --git a/tests/typeset.rs b/tests/typeset.rs index f3c411519..2b342c5bc 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -213,14 +213,14 @@ fn test_part(i: usize, src: &str, env: &SharedEnv) -> (bool, Vec) { ok = false; for diag in &diags { - if ref_diags.binary_search(diag).is_err() { + if !ref_diags.contains(diag) { print!(" Unexpected | "); print_diag(diag, &map); } } for diag in &ref_diags { - if diags.binary_search(diag).is_err() { + if !diags.contains(diag) { print!(" Missing | "); print_diag(diag, &map); }