diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-16 13:24:26 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-16 13:24:26 +0100 |
commit | 39cb6c6d3f78b193f5873c3492e530bbd24d5dd2 (patch) | |
tree | 3b588576a9645d958178c39925f22c291d8a0360 /crates/tools/tests | |
parent | 8c74fd96192679525f985b9f6f85e9bdc011aa09 (diff) | |
parent | 2c4cfb297ec59625310023796b65e3dd48f1e76a (diff) |
Merge #128
128: Add a test to verify if the generated codes are up-to-date. r=matklad a=mominul
This test checks if the generated codes are up-to-date every time during `cargo test`.
I have confirmed that the test works by manually editing the `grammar.ron` file.
Closes #126
Thanks!
Co-authored-by: Muhammad Mominul Huque <[email protected]>
Diffstat (limited to 'crates/tools/tests')
-rw-r--r-- | crates/tools/tests/cli.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/tools/tests/cli.rs b/crates/tools/tests/cli.rs new file mode 100644 index 000000000..f507d80a2 --- /dev/null +++ b/crates/tools/tests/cli.rs | |||
@@ -0,0 +1,13 @@ | |||
1 | extern crate tools; | ||
2 | |||
3 | use tools::{AST, AST_TEMPLATE, SYNTAX_KINDS, SYNTAX_KINDS_TEMPLATE, render_template, update, project_root}; | ||
4 | |||
5 | #[test] | ||
6 | fn verify_template_generation() { | ||
7 | if let Err(error) = update(&project_root().join(SYNTAX_KINDS), &render_template(&project_root().join(SYNTAX_KINDS_TEMPLATE)).unwrap(), true) { | ||
8 | panic!("{}. Please update it by running `cargo gen-kinds`", error); | ||
9 | } | ||
10 | if let Err(error) = update(&project_root().join(AST), &render_template(&project_root().join(AST_TEMPLATE)).unwrap(), true) { | ||
11 | panic!("{}. Please update it by running `cargo gen-kinds`", error); | ||
12 | } | ||
13 | } | ||