Paragraph test

This commit is contained in:
Alex Bethel 2021-11-27 21:20:27 -07:00
parent 622fd3fba5
commit 4d97dcba1a

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