Add tests for detect_plain_list.
This commit is contained in:
parent
bfea828e62
commit
1b678fe81f
@ -419,4 +419,40 @@ dolar"#,
|
|||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn detect_line_break() {
|
||||||
|
let input = OrgSource::new(
|
||||||
|
r#"+
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||||
|
let result = detect_plain_list(&initial_context, input);
|
||||||
|
assert!(result.is_ok());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn detect_eof() {
|
||||||
|
let input = OrgSource::new(r#"+"#);
|
||||||
|
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||||
|
let result = detect_plain_list(&initial_context, input);
|
||||||
|
assert!(result.is_ok());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn detect_no_gap() {
|
||||||
|
let input = OrgSource::new(r#"+foo"#);
|
||||||
|
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||||
|
let result = detect_plain_list(&initial_context, input);
|
||||||
|
// Since there is no whitespace after the '+' this is a paragraph, not a plain list.
|
||||||
|
assert!(result.is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn detect_with_gap() {
|
||||||
|
let input = OrgSource::new(r#"+ foo"#);
|
||||||
|
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||||
|
let result = detect_plain_list(&initial_context, input);
|
||||||
|
assert!(result.is_ok());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user