Skip to content

Instantly share code, notes, and snippets.

@lthms
Created September 9, 2018 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lthms/cc2a6da3e2aace8b9888a25b24e70885 to your computer and use it in GitHub Desktop.
Save lthms/cc2a6da3e2aace8b9888a25b24e70885 to your computer and use it in GitHub Desktop.
#[test]
fn test_document() {
assert_eq!(
document(r#"She opened the letter, and read it.
_____letter____
Dear friend.
I love you.
_______________"#),
Ok(
(
"",
Document(
vec![
Section::Story(
vec![
Paragraph(
vec![
Component::Teller(
vec![
Format::Raw(
vec![
Atom::Word("She"),
Atom::Word("opened"),
Atom::Word("the"),
Atom::Word("letter"),
Atom::Punctuation(Mark::Comma),
Atom::Word("and"),
Atom::Word("read"),
Atom::Word("it"),
Atom::Punctuation(Mark::Point)
]
)
]
)
]
)
]
),
Section::Aside(
Some("letter"),
vec![
Paragraph(
vec![
Component::Teller(
vec![
Format::Raw(
vec![
Atom::Word("Dear"),
Atom::Word("friend"),
Atom::Punctuation(Mark::Point)
]
)
]
)
]
),
Paragraph(
vec![
Component::Teller(
vec![
Format::Raw(
vec![
Atom::Word("I"),
Atom::Word("love"),
Atom::Word("you"),
Atom::Punctuation(Mark::Point)
]
)
]
)
]
)
]
)
]
)
)
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment