diff options
author | Aleksey Kladov <[email protected]> | 2021-03-08 17:22:33 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-03-08 18:45:06 +0000 |
commit | abb6b8f14c4d05cf344048263651d8192997b6cf (patch) | |
tree | ee149a19239f97344687768481f73588447e902a /crates/test_utils/src | |
parent | b6ba0dec0c08dd2afcda951b09966b457f2c8bc3 (diff) |
Use the same name in xtask and test utils
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r-- | crates/test_utils/src/bench_fixture.rs | 6 | ||||
-rw-r--r-- | crates/test_utils/src/lib.rs | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/test_utils/src/bench_fixture.rs b/crates/test_utils/src/bench_fixture.rs index d775e2cc9..3a37c4473 100644 --- a/crates/test_utils/src/bench_fixture.rs +++ b/crates/test_utils/src/bench_fixture.rs | |||
@@ -4,7 +4,7 @@ use std::fs; | |||
4 | 4 | ||
5 | use stdx::format_to; | 5 | use stdx::format_to; |
6 | 6 | ||
7 | use crate::project_dir; | 7 | use crate::project_root; |
8 | 8 | ||
9 | pub fn big_struct() -> String { | 9 | pub fn big_struct() -> String { |
10 | let n = 1_000; | 10 | let n = 1_000; |
@@ -32,11 +32,11 @@ struct S{} {{ | |||
32 | } | 32 | } |
33 | 33 | ||
34 | pub fn glorious_old_parser() -> String { | 34 | pub fn glorious_old_parser() -> String { |
35 | let path = project_dir().join("bench_data/glorious_old_parser"); | 35 | let path = project_root().join("bench_data/glorious_old_parser"); |
36 | fs::read_to_string(&path).unwrap() | 36 | fs::read_to_string(&path).unwrap() |
37 | } | 37 | } |
38 | 38 | ||
39 | pub fn numerous_macro_rules() -> String { | 39 | pub fn numerous_macro_rules() -> String { |
40 | let path = project_dir().join("bench_data/numerous_macro_rules"); | 40 | let path = project_root().join("bench_data/numerous_macro_rules"); |
41 | fs::read_to_string(&path).unwrap() | 41 | fs::read_to_string(&path).unwrap() |
42 | } | 42 | } |
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index 7f122b13e..097a54139 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs | |||
@@ -288,14 +288,14 @@ pub fn skip_slow_tests() -> bool { | |||
288 | if should_skip { | 288 | if should_skip { |
289 | eprintln!("ignoring slow test") | 289 | eprintln!("ignoring slow test") |
290 | } else { | 290 | } else { |
291 | let path = project_dir().join("./target/.slow_tests_cookie"); | 291 | let path = project_root().join("./target/.slow_tests_cookie"); |
292 | fs::write(&path, ".").unwrap(); | 292 | fs::write(&path, ".").unwrap(); |
293 | } | 293 | } |
294 | should_skip | 294 | should_skip |
295 | } | 295 | } |
296 | 296 | ||
297 | /// Returns the path to the root directory of `rust-analyzer` project. | 297 | /// Returns the path to the root directory of `rust-analyzer` project. |
298 | pub fn project_dir() -> PathBuf { | 298 | pub fn project_root() -> PathBuf { |
299 | let dir = env!("CARGO_MANIFEST_DIR"); | 299 | let dir = env!("CARGO_MANIFEST_DIR"); |
300 | PathBuf::from(dir).parent().unwrap().parent().unwrap().to_owned() | 300 | PathBuf::from(dir).parent().unwrap().parent().unwrap().to_owned() |
301 | } | 301 | } |
@@ -371,7 +371,7 @@ pub fn try_ensure_file_contents(file: &Path, contents: &str) -> Result<(), ()> { | |||
371 | } | 371 | } |
372 | _ => (), | 372 | _ => (), |
373 | } | 373 | } |
374 | let display_path = file.strip_prefix(&project_dir()).unwrap_or(file); | 374 | let display_path = file.strip_prefix(&project_root()).unwrap_or(file); |
375 | eprintln!( | 375 | eprintln!( |
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() |