mirror of
https://github.com/unclebob/crapper.git
synced 2026-11-07 10:33:50 +00:00
Fix the coverage, git, and Clojure bugs, and bring CRAP under 10.
A path in a built-in coverage command is one argument, a failed custom coverage command does not read a stale report, and git failures exit with git's status. The Clojure reader honors discards, metadata, and character literals. Long functions are split so every score is under 10 except the option switch.
This commit is contained in:
+7
-1
@@ -1,4 +1,6 @@
|
||||
from crapper.languages.rust import functions_in_source
|
||||
from pathlib import Path
|
||||
|
||||
from crapper.languages.rust import _file_modules, functions_in_source
|
||||
|
||||
SOURCE = """
|
||||
pub fn choose(x: i32) -> i32 {
|
||||
@@ -80,6 +82,10 @@ def test_module_paths_outside_the_usual_layout(tmp_path):
|
||||
assert bare[0].name == "bare"
|
||||
|
||||
|
||||
def test_a_file_outside_the_crate_root_uses_the_crate_name():
|
||||
assert _file_modules("/tmp/loose.rs", "demo", Path("/projects/demo")) == ["demo"]
|
||||
|
||||
|
||||
def test_nested_module_path(tmp_path):
|
||||
(tmp_path / "Cargo.toml").write_text(
|
||||
'[package]\nname = "demo"\nversion = "0.1.0"\n',
|
||||
|
||||
Reference in New Issue
Block a user