aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-03-08 18:13:15 +0000
committerAleksey Kladov <[email protected]>2021-03-08 18:45:37 +0000
commit1eb61203b725684fd2c7e25ac7e2d53eef10c64c (patch)
treeaae264078123fc4b9cbe6c9189179f6f147f8a88 /crates
parentabb6b8f14c4d05cf344048263651d8192997b6cf (diff)
Make `code generation` just work
Contributors don't need to learn about `cargo xtask codegen` if `cargo test` just does the right thing.
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/config.rs4
-rw-r--r--crates/test_utils/src/lib.rs5
2 files changed, 6 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index bceca2b0f..078c83f75 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -864,7 +864,7 @@ mod tests {
864 use super::*; 864 use super::*;
865 865
866 #[test] 866 #[test]
867 fn ensure_schema_in_package_json() { 867 fn generate_package_json_config() {
868 let s = Config::json_schema(); 868 let s = Config::json_schema();
869 let schema = format!("{:#}", s); 869 let schema = format!("{:#}", s);
870 let mut schema = schema 870 let mut schema = schema
@@ -895,7 +895,7 @@ mod tests {
895 } 895 }
896 896
897 #[test] 897 #[test]
898 fn schema_in_sync_with_docs() { 898 fn generate_config_documentation() {
899 let docs_path = project_root().join("docs/user/generated_config.adoc"); 899 let docs_path = project_root().join("docs/user/generated_config.adoc");
900 let current = fs::read_to_string(&docs_path).unwrap(); 900 let current = fs::read_to_string(&docs_path).unwrap();
901 let expected = ConfigData::manual(); 901 let expected = ConfigData::manual();
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs
index 097a54139..dd582c77c 100644
--- a/crates/test_utils/src/lib.rs
+++ b/crates/test_utils/src/lib.rs
@@ -18,7 +18,7 @@ use std::{
18}; 18};
19 19
20use profile::StopWatch; 20use profile::StopWatch;
21use stdx::lines_with_ends; 21use stdx::{is_ci, lines_with_ends};
22use text_size::{TextRange, TextSize}; 22use text_size::{TextRange, TextSize};
23 23
24pub use dissimilar::diff as __diff; 24pub use dissimilar::diff as __diff;
@@ -376,6 +376,9 @@ pub fn try_ensure_file_contents(file: &Path, contents: &str) -> Result<(), ()> {
376 "\n\x1b[31;1merror\x1b[0m: {} was not up-to-date, updating\n", 376 "\n\x1b[31;1merror\x1b[0m: {} was not up-to-date, updating\n",
377 display_path.display() 377 display_path.display()
378 ); 378 );
379 if is_ci() {
380 eprintln!("\n NOTE: run `cargo test` locally and commit the updated files\n");
381 }
379 if let Some(parent) = file.parent() { 382 if let Some(parent) = file.parent() {
380 let _ = std::fs::create_dir_all(parent); 383 let _ = std::fs::create_dir_all(parent);
381 } 384 }