6c4c3448e3
* Removed the itertools dependency * Removed an unused feature flag * Stubbed out a toml_query replacement * Update dependencies. * Bump env_logger. * Use warp instead of iron for http server. Iron does not appear to be maintained anymore. warp/hyper seems to be reasonably maintained. Unfortunately this takes a few seconds more to compile, but shouldn't be too bad. One benefit is that there is no longer a need for a separate websocket port, which makes it easier to run multiple servers at once. * Update pulldown-cmark to 0.7 * Switch from error-chain to anyhow. * Bump MSRV to 1.39. * Update elasticlunr-rs. Co-authored-by: Michael Bryan <michaelfbryan@gmail.com>
44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
//! Some integration tests to make sure the `SUMMARY.md` parser can deal with
|
|
//! some real-life examples.
|
|
|
|
use mdbook::book;
|
|
use std::fs::File;
|
|
use std::io::Read;
|
|
use std::path::Path;
|
|
|
|
macro_rules! summary_md_test {
|
|
($name:ident, $filename:expr) => {
|
|
#[test]
|
|
fn $name() {
|
|
env_logger::try_init().ok();
|
|
|
|
let filename = Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
.join("tests")
|
|
.join("summary_md_files")
|
|
.join($filename);
|
|
|
|
if !filename.exists() {
|
|
panic!("{} Doesn't exist", filename.display());
|
|
}
|
|
|
|
let mut content = String::new();
|
|
File::open(&filename)
|
|
.unwrap()
|
|
.read_to_string(&mut content)
|
|
.unwrap();
|
|
|
|
if let Err(e) = book::parse_summary(&content) {
|
|
eprintln!("Error parsing {}", filename.display());
|
|
eprintln!();
|
|
eprintln!("{:?}", e);
|
|
panic!();
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
summary_md_test!(rust_by_example, "rust_by_example.md");
|
|
summary_md_test!(rust_ffi_guide, "rust_ffi_guide.md");
|
|
summary_md_test!(example_book, "example_book.md");
|
|
summary_md_test!(the_book_2nd_edition, "the_book-2nd_edition.md");
|