use roc_docs::{documentation_to_template_data, files_to_documentations, ModuleEntry}; use std::path::PathBuf; #[cfg(test)] mod test_docs { use super::*; #[test] fn internal() { let files_docs = files_to_documentations( vec![PathBuf::from(r"tests/fixtures/Interface.roc")], roc_builtins::std::standard_stdlib(), ); let package = roc_load::docs::Documentation { name: "roc/builtins".to_string(), version: "1.0.0".to_string(), docs: "Package introduction or README.".to_string(), modules: files_docs, }; let expected_entries = vec![ ModuleEntry { name: "Block".to_string(), docs: "
This is a block
\n".to_string(), }, ModuleEntry { name: "singleline".to_string(), docs: "Single line documentation.
\n".to_string(), }, ModuleEntry { name: "multiline".to_string(), docs: "Multiline documentation.\nWithout any complex syntax yet!
\n".to_string(), }, ModuleEntry { name: "multiparagraph".to_string(), docs: "Multiparagraph documentation.
\nWithout any complex syntax yet!
\n".to_string(), }, ModuleEntry { name: "codeblock".to_string(), docs: "Turns >>> into code block for now.
\ncodeblock
\n".to_string(),
},
];
for module in &package.modules {
let template = documentation_to_template_data(&package, module);
assert_eq!(template.module_name, "Test");
template
.module_entries
.iter()
.zip(expected_entries.iter())
.for_each(|(x, y)| assert_eq!(x, y));
}
}
}