From 134fe4f566d94fd4ca91c6417fab0ae7b3e4275f Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 20 Dec 2018 16:45:54 +0000 Subject: Fix the tests and fix the precommit hook --- crates/tools/src/bin/pre-commit.rs | 3 ++- crates/tools/src/lib.rs | 2 +- crates/tools/src/main.rs | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'crates/tools/src') diff --git a/crates/tools/src/bin/pre-commit.rs b/crates/tools/src/bin/pre-commit.rs index ca1909479..bae3b26d3 100644 --- a/crates/tools/src/bin/pre-commit.rs +++ b/crates/tools/src/bin/pre-commit.rs @@ -14,13 +14,14 @@ fn update_staged() -> Result<()> { let root = project_root(); let output = Command::new("git") .arg("diff") + .arg("--diff-filter=MAR") .arg("--name-only") .arg("--cached") .current_dir(&root) .output()?; if !output.status.success() { bail!( - "`git diff --name-only --cached` exited with {}", + "`git diff --diff-filter=MAR --name-only --cached` exited with {}", output.status ); } diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index 6d4ac4726..580d8b802 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -47,7 +47,7 @@ pub fn collect_tests(s: &str) -> Vec<(usize, Test)> { } Some((idx, line)) if line.starts_with("test_err ") => { ok = false; - break (idx, line["test_fail ".len()..].to_string()); + break (idx, line["test_err ".len()..].to_string()); } Some(_) => (), None => continue 'outer, diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs index 08b21f7af..0e54cadda 100644 --- a/crates/tools/src/main.rs +++ b/crates/tools/src/main.rs @@ -54,13 +54,13 @@ fn gen_tests(mode: Mode) -> Result<()> { if !tests_dir.is_dir() { fs::create_dir_all(&tests_dir)?; } - // ok is never is actually read, but it needs to be specified to create a Test in existing_tests + // ok is never actually read, but it needs to be specified to create a Test in existing_tests let existing = existing_tests(&tests_dir, true)?; for t in existing.keys().filter(|&t| !tests.contains_key(t)) { - panic!("Test is deleted: {}", t); + // panic!("Test is deleted: {}", t); } - let mut new_idx = existing.len() + 2; + let mut new_idx = existing.len() + 1; for (name, test) in tests { let path = match existing.get(name) { Some((path, _test)) => path.clone(), -- cgit v1.2.3