added cargo-tarpaulin to flake, added some tests to cracked_md
All checks were successful
Test the running changes / Test (push) Successful in 40s

This commit is contained in:
2025-11-23 20:52:05 +02:00
parent 1aa6af3b1a
commit 7d602fffba
4 changed files with 46 additions and 1 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ site/
target/ target/
result result
tarpaulin-report.html

View File

@@ -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```";

View File

@@ -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());
}
} }

View File

@@ -25,6 +25,7 @@
cargo-nextest cargo-nextest
cargo-expand cargo-expand
cargo-watch cargo-watch
cargo-tarpaulin
]; ];
}; };
} }