Skip to content

Commit

Permalink
Add tests for new syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 18, 2019
1 parent 08df86a commit 7c4986e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/parse.rs
Expand Up @@ -3077,4 +3077,37 @@ mod test {
}
assert!(link_tag_count > 0);
}

#[test]
fn code_block_kind_check_fenced() {
let parser = Parser::new("hello\n```test\ntadam\n```");
let mut found = 0;
for (ev, _range) in parser.into_offset_iter() {
match ev {
Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(fences), syntax)) => {
assert_eq!(fences.as_ref(), "```");
assert_eq!(syntax.as_ref(), "test");
found += 1;
}
_ => {}
}
}
assert_eq!(found, 1);
}

#[test]
fn code_block_kind_check_indented() {
let parser = Parser::new("hello\n\n ```test\n tadam\nhello");
let mut found = 0;
for (ev, _range) in parser.into_offset_iter() {
match ev {
Event::Start(Tag::CodeBlock(CodeBlockKind::Indented, syntax)) => {
assert_eq!(syntax.as_ref(), "");
found += 1;
}
_ => {}
}
}
assert_eq!(found, 1);
}
}

0 comments on commit 7c4986e

Please sign in to comment.