Skip to content

Commit e3d543b

Browse files
committed
Add spec for relaxed and table matches
1 parent 462c759 commit e3d543b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/tests/tasklist.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,3 +552,43 @@ fn tasklist_symbol_sourcepos() {
552552
]
553553
);
554554
}
555+
556+
#[test]
557+
fn tasklist_symbol_sourcepos_relaxed() {
558+
let mut options = Options::default();
559+
options.extension.tasklist = true;
560+
options.extension.table = true;
561+
options.parse.relaxed_tasklist_matching = true;
562+
options.parse.tasklist_in_table = true;
563+
564+
let arena = Arena::new();
565+
let md = r#"Henlo!
566+
567+
> - [あ] well
568+
>
569+
> 1. * > 3. [和] true
570+
571+
| hm | |
572+
| ---- | -- |
573+
| [ワ] | ok |
574+
"#;
575+
576+
let root = parse_document(&arena, md, &options);
577+
let sourceposes = root
578+
.descendants()
579+
.filter_map(|n| {
580+
let NodeValue::TaskItem(ref nti) = n.data().value else {
581+
return None;
582+
};
583+
Some(nti.symbol_sourcepos)
584+
})
585+
.collect::<Vec<_>>();
586+
assert_eq!(
587+
sourceposes,
588+
vec![
589+
(3, 6, 3, 8).into(),
590+
(5, 16, 5, 18).into(),
591+
(9, 4, 9, 6).into()
592+
]
593+
);
594+
}

0 commit comments

Comments
 (0)