Skip to main content

isoloom_render/
output.rs

1//! The generated files: where they go in the project, and the lines each starts with.
2
3pub use isoloom_spec::files::GeneratedFile;
4
5/// Where generated files go, relative to the project folder.
6pub const OUTPUT_DIR: &str = ".isoloom";
7
8/// The first lines of every generated file: it is generated and how to change it (`comment`
9/// is the file's comment marker, `#` or `//`).
10#[must_use]
11pub fn header(comment: &str) -> String {
12    format!(
13        "{comment} Generated by isoloom from isoloom.yml. Don't edit: change isoloom.yml and run\n{comment} `isoloom generate`. `isoloom check` fails when this file is out of date.\n"
14    )
15}
16
17#[cfg(test)]
18mod tests {
19    #[test]
20    fn the_header_says_how_to_change_the_file_in_its_own_comments() {
21        assert_eq!(
22            super::header("//"),
23            "// Generated by isoloom from isoloom.yml. Don't edit: change isoloom.yml and run\n// `isoloom generate`. `isoloom check` fails when this file is out of date.\n"
24        );
25    }
26}