aboutsummaryrefslogtreecommitdiff
path: root/tests/ast.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-06-19 09:17:36 +0000
committerFuwn <[email protected]>2024-06-19 09:17:36 +0000
commit6d92ea622bfc98a831a9b94f19896fe0c215f794 (patch)
tree34a8341128580cc190caecb16e9c62e2eb1f72ec /tests/ast.rs
parentfeat(germ): bump version (diff)
downloadgerm-0.4.2.tar.xz
germ-0.4.2.zip
fix(ast): parse preformatted gemtext as preformatted contentv0.4.2
Diffstat (limited to 'tests/ast.rs')
-rw-r--r--tests/ast.rs69
1 files changed, 17 insertions, 52 deletions
diff --git a/tests/ast.rs b/tests/ast.rs
index f95591a..021fd96 100644
--- a/tests/ast.rs
+++ b/tests/ast.rs
@@ -18,69 +18,34 @@
#[cfg(test)]
mod test {
- use germ::ast::{Ast, Node};
-
- const EXAMPLE_GEMTEXT: &str = r#"```This is alt-text
-Here goes the pre-formatted text.
-
-This continues the pre-formatted text on a new line after a blank line.
-```
-
-# This is a heading
-
-This is some text.
-
-This is more text after a blank line.
-
-* This is a single list item.
-* This is the next list item.
-
-* This is a new list.
-* This is the next item on the new list.
-
-## This is a sub-heading
-
-> This is a blockquote.
-
-### This is a sub-sub-heading.
-
-=> gemini://gem.rest/ This is a link to GemRest
-=> /somewhere
-
-That was a link without text."#;
+ use germ::{
+ ast::{Ast, Node},
+ EXAMPLE_GEMTEXT,
+ };
#[test]
fn build_multi_line_list_with_text() {
- assert_eq!(
- *Ast::from_string("* item1\n* 2\nhi text").inner(),
- vec![
- Node::List(vec!["item1".to_string(), "2".to_string()]),
- Node::Text("hi text".to_string()),
- ],
- );
+ assert_eq!(*Ast::from_string("* item1\n* 2\nhi text").inner(), vec![
+ Node::List(vec!["item1".to_string(), "2".to_string()]),
+ Node::Text("hi text".to_string()),
+ ],);
}
#[test]
fn build_multi_line_vec() {
- assert_eq!(
- *Ast::from_string("=> /test hi\nhi there\n> hi").inner(),
- vec![
- Node::Link { to: "/test".to_string(), text: Some("hi".to_string()) },
- Node::Text("hi there".to_string()),
- Node::Blockquote("hi".to_string()),
- ],
- );
+ assert_eq!(*Ast::from_string("=> /test hi\nhi there\n> hi").inner(), vec![
+ Node::Link { to: "/test".to_string(), text: Some("hi".to_string()) },
+ Node::Text("hi there".to_string()),
+ Node::Blockquote("hi".to_string()),
+ ],);
}
#[test]
fn build_single_0th_from_vec() {
- assert_eq!(
- Ast::from_string("=> /test hi").inner(),
- &vec![Node::Link {
- to: "/test".to_string(),
- text: Some("hi".to_string()),
- }],
- );
+ assert_eq!(Ast::from_string("=> /test hi").inner(), &vec![Node::Link {
+ to: "/test".to_string(),
+ text: Some("hi".to_string()),
+ }],);
}
#[test]