Paragraph test
This commit is contained in:
parent
622fd3fba5
commit
4d97dcba1a
34
src/lib.rs
34
src/lib.rs
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue