added cargo-tarpaulin to flake, added some tests to cracked_md
All checks were successful
Test the running changes / Test (push) Successful in 40s
All checks were successful
Test the running changes / Test (push) Successful in 40s
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ site/
|
|||||||
target/
|
target/
|
||||||
|
|
||||||
result
|
result
|
||||||
|
tarpaulin-report.html
|
||||||
|
|||||||
@@ -133,6 +133,20 @@ mod test {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn code_block_content_after_end() {
|
||||||
|
let md = "```\necho hello\n```abc";
|
||||||
|
let doc_res = parse(md);
|
||||||
|
assert!(doc_res.is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn code_block_no_terminating() {
|
||||||
|
let md = "```\nabc\n";
|
||||||
|
let doc_res = parse(md);
|
||||||
|
assert!(doc_res.is_err());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rust_code_block() {
|
fn rust_code_block() {
|
||||||
let md = "```rust\nfn main() {\n\tprintln!(\"Hello world!\");\n}\n```";
|
let md = "```rust\nfn main() {\n\tprintln!(\"Hello world!\");\n}\n```";
|
||||||
|
|||||||
@@ -69,7 +69,14 @@ fn collect_until<I: Iterator<Item = char>>(
|
|||||||
mod test {
|
mod test {
|
||||||
use crate::ast::Inline;
|
use crate::ast::Inline;
|
||||||
|
|
||||||
use super::parse_inlines;
|
use super::{collect_until, parse_inlines};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn collect_until_without_end() {
|
||||||
|
let mut s = "abcdef".chars().peekable();
|
||||||
|
let res = collect_until(&mut s, '.');
|
||||||
|
assert!(res.is_err());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bold_text() {
|
fn bold_text() {
|
||||||
@@ -128,4 +135,26 @@ mod test {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn single_hyperlink() {
|
||||||
|
let md = "[my site](https://example.com)";
|
||||||
|
let inl = parse_inlines(md).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
inl,
|
||||||
|
vec![Inline::Link {
|
||||||
|
text: vec![Inline::Text("my site".to_string())],
|
||||||
|
href: "https://example.com".to_string()
|
||||||
|
}]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn hyperlink_without_link() {
|
||||||
|
let md = "[abc]";
|
||||||
|
let inl = parse_inlines(md);
|
||||||
|
|
||||||
|
assert!(inl.is_err());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user