2018-10-14 09:32:57 -05:00
|
|
|
extern crate tools;
|
|
|
|
|
|
|
|
use std::path::Path;
|
|
|
|
use tools::{render_template, update};
|
|
|
|
|
|
|
|
const SYNTAX_KINDS: &str = "../ra_syntax/src/syntax_kinds/generated.rs";
|
|
|
|
const SYNTAX_KINDS_TEMPLATE: &str = "../ra_syntax/src/syntax_kinds/generated.rs.tera";
|
|
|
|
const AST: &str = "../ra_syntax/src/ast/generated.rs";
|
|
|
|
const AST_TEMPLATE: &str = "../ra_syntax/src/ast/generated.rs.tera";
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn verify_template_generation() {
|
2018-10-15 12:52:11 -05:00
|
|
|
if let Err(error) = update(Path::new(SYNTAX_KINDS), &render_template(SYNTAX_KINDS_TEMPLATE).unwrap(), true) {
|
2018-10-14 09:58:53 -05:00
|
|
|
panic!("{}. Please update it by running `cargo gen-kinds`", error);
|
|
|
|
}
|
2018-10-15 12:52:11 -05:00
|
|
|
if let Err(error) = update(Path::new(AST), &render_template(AST_TEMPLATE).unwrap(), true) {
|
2018-10-14 09:58:53 -05:00
|
|
|
panic!("{}. Please update it by running `cargo gen-kinds`", error);
|
|
|
|
}
|
2018-10-15 12:52:11 -05:00
|
|
|
}
|