blob: fde2c235d36c5bf9b03ecf5958a21e2efc86c7b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
//! Compares input to expected output.
use std::path::PathBuf;
use mdman::{Format, ManMap};
use url::Url;
fn run(name: &str) {
let input = PathBuf::from(format!("tests/compare/{}.md", name));
let url = Some(Url::parse("https://example.org/").unwrap());
let mut map = ManMap::new();
map.insert(
("other-cmd".to_string(), 1),
"https://example.org/commands/other-cmd.html".to_string(),
);
for &format in &[Format::Man, Format::Md, Format::Text] {
let section = mdman::extract_section(&input).unwrap();
let result = mdman::convert(&input, format, url.clone(), map.clone()).unwrap();
let expected_path = format!(
"tests/compare/expected/{}.{}",
name,
format.extension(section)
);
snapbox::assert_eq_path(expected_path, result);
}
}
macro_rules! test( ($name:ident) => (
#[test]
fn $name() { run(stringify!($name)); }
) );
test!(formatting);
test!(links);
test!(options);
test!(tables);
test!(vars);
|