Add tests for detect_plain_list.

This commit is contained in:
Tom Alexander 2023-08-25 05:25:41 -04:00
parent bfea828e62
commit 1b678fe81f
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 36 additions and 0 deletions

View File

@ -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());
}
}