aboutsummaryrefslogtreecommitdiff
path: root/crates/tools/tests/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/tools/tests/cli.rs')
-rw-r--r--crates/tools/tests/cli.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/crates/tools/tests/cli.rs b/crates/tools/tests/cli.rs
index 9ff1eecd9..d0ed60f7a 100644
--- a/crates/tools/tests/cli.rs
+++ b/crates/tools/tests/cli.rs
@@ -1,19 +1,13 @@
1extern crate tools; 1extern crate tools;
2 2
3use std::path::Path; 3use tools::{AST, AST_TEMPLATE, SYNTAX_KINDS, SYNTAX_KINDS_TEMPLATE, render_template, update, project_root};
4use tools::{render_template, update};
5
6const SYNTAX_KINDS: &str = "../ra_syntax/src/syntax_kinds/generated.rs";
7const SYNTAX_KINDS_TEMPLATE: &str = "../ra_syntax/src/syntax_kinds/generated.rs.tera";
8const AST: &str = "../ra_syntax/src/ast/generated.rs";
9const AST_TEMPLATE: &str = "../ra_syntax/src/ast/generated.rs.tera";
10 4
11#[test] 5#[test]
12fn verify_template_generation() { 6fn verify_template_generation() {
13 if let Err(error) = update(Path::new(SYNTAX_KINDS), &render_template(SYNTAX_KINDS_TEMPLATE).unwrap(), true) { 7 if let Err(error) = update(&project_root().join(SYNTAX_KINDS), &render_template(project_root().join(SYNTAX_KINDS_TEMPLATE)).unwrap(), true) {
14 panic!("{}. Please update it by running `cargo gen-kinds`", error); 8 panic!("{}. Please update it by running `cargo gen-kinds`", error);
15 } 9 }
16 if let Err(error) = update(Path::new(AST), &render_template(AST_TEMPLATE).unwrap(), true) { 10 if let Err(error) = update(&project_root().join(AST), &render_template(project_root().join(AST_TEMPLATE)).unwrap(), true) {
17 panic!("{}. Please update it by running `cargo gen-kinds`", error); 11 panic!("{}. Please update it by running `cargo gen-kinds`", error);
18 } 12 }
19} 13}