summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2022-01-02 14:46:08 +0100
committerMartin Haug <mhaug@live.de>2022-01-02 14:46:08 +0100
commit98c96ba1cb8a46e327de313118e4ce1a84795ae9 (patch)
treeb27b8e5c8e0cc6ed530c67eeeca5019fa0e18986 /tests
parent5f114e18eb76a1937941b2ea64842b908c9ad89e (diff)
Fix parser / space / error bug
Diffstat (limited to 'tests')
-rw-r--r--tests/typ/code/let.typ1
-rw-r--r--tests/typeset.rs12
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/typ/code/let.typ b/tests/typ/code/let.typ
index a95d651a..d4765ea5 100644
--- a/tests/typ/code/let.typ
+++ b/tests/typ/code/let.typ
@@ -59,6 +59,7 @@ Three
// Error: 18 expected expression
// Error: 18 expected closing paren
#let v5 = (1, 2 + ; Five
+ ^^^^^ + \r\n
---
// Error: 13 expected body
diff --git a/tests/typeset.rs b/tests/typeset.rs
index f23de5cd..aa3bcf9d 100644
--- a/tests/typeset.rs
+++ b/tests/typeset.rs
@@ -412,6 +412,15 @@ fn test_reparse(src: &str, i: usize, rng: &mut LinearShift) -> bool {
let apply = |replace: std::ops::Range<usize>, with| {
let mut incr_source = SourceFile::detached(src);
+ if incr_source.root().len() != src.len() {
+ println!(
+ " Subtest {} tree length {} does not match string length {} ❌",
+ i,
+ incr_source.root().len(),
+ src.len(),
+ );
+ return false;
+ }
incr_source.edit(replace.clone(), with);
let edited_src = incr_source.src();
@@ -428,7 +437,7 @@ fn test_reparse(src: &str, i: usize, rng: &mut LinearShift) -> bool {
"\n Expected reference tree:\n{:#?}\n\n Found incremental tree:\n{:#?}",
ref_root, incr_root
);
- println!("Full source ({}):\n\"{}\"", edited_src.len(), edited_src);
+ println!("Full source ({}):\n\"{:?}\"", edited_src.len(), edited_src);
false
} else {
true
@@ -454,7 +463,6 @@ fn test_reparse(src: &str, i: usize, rng: &mut LinearShift) -> bool {
if !apply(start .. end, supplement) {
println!("original tree: {:#?}", SourceFile::detached(src).root());
-
ok = false;
}
}