Paragraph test

issue1
Alex Bethel 2021-11-27 21:20:27 -07:00
parent 8d8ecbcbd1
commit 2b6e6746f9
1 changed files with 32 additions and 2 deletions

View File

@ -103,8 +103,7 @@ mod tests {
#[test]
fn basic_text() {
let text = "Hello World!";
let doc = parse(text);
let doc = parse("Hello World!");
let doc_ref = Document(vec![Node::Paragraph(vec![StyledText {
italic: false,
bold: false,
@ -115,4 +114,35 @@ mod tests {
assert_eq!(doc, doc_ref);
}
/// Single paragraphs are allowed to include newlines; double
/// newlines, however, separate paragraphs.
#[test]
fn paragraphs() {
let doc = parse(
"\
Hello
World!
New paragraph",
);
let doc_ref = Document(vec![
Node::Paragraph(vec![StyledText {
italic: false,
bold: false,
underline: false,
color: None,
text: "Hello World!".to_string(),
}]),
Node::Paragraph(vec![StyledText {
italic: false,
bold: false,
underline: false,
color: None,
text: "New paragraph".to_string(),
}]),
]);
assert_eq!(doc, doc_ref);
}
}