diff options
author | Muhammad Mominul Huque <mominul2082@gmail.com> | 2018-10-15 19:54:27 +0100 |
---|---|---|
committer | Muhammad Mominul Huque <mominul2082@gmail.com> | 2018-10-15 19:54:27 +0100 |
commit | 9d9e637ef39cbc00eaebad93294a60ccfd3405eb (patch) | |
tree | ec844156b4f2c867a860d802edfb463c156a2f37 /crates/tools/tests | |
parent | ce73df065f89bb5aa17517de16c10f9e4d3abaeb (diff) |
Refactor the constants
Diffstat (limited to 'crates/tools/tests')
-rw-r--r-- | crates/tools/tests/cli.rs | 12 |
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 @@ | |||
1 | extern crate tools; | 1 | extern crate tools; |
2 | 2 | ||
3 | use std::path::Path; | 3 | use tools::{AST, AST_TEMPLATE, SYNTAX_KINDS, SYNTAX_KINDS_TEMPLATE, render_template, update, project_root}; |
4 | use tools::{render_template, update}; | ||
5 | |||
6 | const SYNTAX_KINDS: &str = "../ra_syntax/src/syntax_kinds/generated.rs"; | ||
7 | const SYNTAX_KINDS_TEMPLATE: &str = "../ra_syntax/src/syntax_kinds/generated.rs.tera"; | ||
8 | const AST: &str = "../ra_syntax/src/ast/generated.rs"; | ||
9 | const AST_TEMPLATE: &str = "../ra_syntax/src/ast/generated.rs.tera"; | ||
10 | 4 | ||
11 | #[test] | 5 | #[test] |
12 | fn verify_template_generation() { | 6 | fn 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 | } |