From 8ec5f2fcdcdd2e2a9297093189ad8c05e1dd7a8f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 7 Dec 2019 12:46:36 +0100 Subject: Skip slow tests by default --- crates/test_utils/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crates/test_utils/src') diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index 1244ea8cf..657ddf2a6 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs @@ -356,6 +356,17 @@ pub fn read_text(path: &Path) -> String { .replace("\r\n", "\n") } +pub fn skip_slow_tests() -> bool { + let should_skip = std::env::var("CI").is_err() && std::env::var("RUN_SLOW_TESTS").is_err(); + if should_skip { + eprintln!("ignoring slow test") + } else { + let path = project_dir().join("./target/.slow_tests_cookie"); + fs::write(&path, ".").unwrap(); + } + should_skip +} + const REWRITE: bool = false; fn assert_equal_text(expected: &str, actual: &str, path: &Path) { -- cgit v1.2.3 From 46a299bceece6f8633d7c1518939efbb3a57fae3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 18 Dec 2019 15:33:36 +0100 Subject: Refactor goto tests to always specify texts --- crates/test_utils/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/test_utils/src') diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index 657ddf2a6..659f77b71 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs @@ -207,8 +207,8 @@ pub fn lines_match(expected: &str, actual: &str) -> bool { // Let's not deal with / vs \ (windows...) // First replace backslash-escaped backslashes with forward slashes // which can occur in, for example, JSON output - let expected = expected.replace("\\\\", "/").replace("\\", "/"); - let mut actual: &str = &actual.replace("\\\\", "/").replace("\\", "/"); + let expected = expected.replace(r"\\", "/").replace(r"\", "/"); + let mut actual: &str = &actual.replace(r"\\", "/").replace(r"\", "/"); for (i, part) in expected.split("[..]").enumerate() { match actual.find(part) { Some(j) => { -- cgit v1.2.3