diff options
author | DJMcNab <[email protected]> | 2018-12-20 16:45:54 +0000 |
---|---|---|
committer | DJMcNab <[email protected]> | 2018-12-20 16:45:54 +0000 |
commit | 134fe4f566d94fd4ca91c6417fab0ae7b3e4275f (patch) | |
tree | 54d5d31d8df65982163e1ff735e1461d672d8376 /crates/tools/src | |
parent | 466885aa5bad53732786380f7579880fe2fd5645 (diff) |
Fix the tests and fix the precommit hook
Diffstat (limited to 'crates/tools/src')
-rw-r--r-- | crates/tools/src/bin/pre-commit.rs | 3 | ||||
-rw-r--r-- | crates/tools/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/tools/src/main.rs | 6 |
3 files changed, 6 insertions, 5 deletions
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<()> { | |||
14 | let root = project_root(); | 14 | let root = project_root(); |
15 | let output = Command::new("git") | 15 | let output = Command::new("git") |
16 | .arg("diff") | 16 | .arg("diff") |
17 | .arg("--diff-filter=MAR") | ||
17 | .arg("--name-only") | 18 | .arg("--name-only") |
18 | .arg("--cached") | 19 | .arg("--cached") |
19 | .current_dir(&root) | 20 | .current_dir(&root) |
20 | .output()?; | 21 | .output()?; |
21 | if !output.status.success() { | 22 | if !output.status.success() { |
22 | bail!( | 23 | bail!( |
23 | "`git diff --name-only --cached` exited with {}", | 24 | "`git diff --diff-filter=MAR --name-only --cached` exited with {}", |
24 | output.status | 25 | output.status |
25 | ); | 26 | ); |
26 | } | 27 | } |
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)> { | |||
47 | } | 47 | } |
48 | Some((idx, line)) if line.starts_with("test_err ") => { | 48 | Some((idx, line)) if line.starts_with("test_err ") => { |
49 | ok = false; | 49 | ok = false; |
50 | break (idx, line["test_fail ".len()..].to_string()); | 50 | break (idx, line["test_err ".len()..].to_string()); |
51 | } | 51 | } |
52 | Some(_) => (), | 52 | Some(_) => (), |
53 | None => continue 'outer, | 53 | 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<()> { | |||
54 | if !tests_dir.is_dir() { | 54 | if !tests_dir.is_dir() { |
55 | fs::create_dir_all(&tests_dir)?; | 55 | fs::create_dir_all(&tests_dir)?; |
56 | } | 56 | } |
57 | // ok is never is actually read, but it needs to be specified to create a Test in existing_tests | 57 | // ok is never actually read, but it needs to be specified to create a Test in existing_tests |
58 | let existing = existing_tests(&tests_dir, true)?; | 58 | let existing = existing_tests(&tests_dir, true)?; |
59 | for t in existing.keys().filter(|&t| !tests.contains_key(t)) { | 59 | for t in existing.keys().filter(|&t| !tests.contains_key(t)) { |
60 | panic!("Test is deleted: {}", t); | 60 | // panic!("Test is deleted: {}", t); |
61 | } | 61 | } |
62 | 62 | ||
63 | let mut new_idx = existing.len() + 2; | 63 | let mut new_idx = existing.len() + 1; |
64 | for (name, test) in tests { | 64 | for (name, test) in tests { |
65 | let path = match existing.get(name) { | 65 | let path = match existing.get(name) { |
66 | Some((path, _test)) => path.clone(), | 66 | Some((path, _test)) => path.clone(), |