Answer review: keep Rust test modules for bugs only, order imports, reword
CI / tests (pull_request) Has been cancelled

This commit is contained in:
2026-11-26 01:30:46 +01:00
parent 347368040e
commit cecabf324a
6 changed files with 49 additions and 33 deletions
+10 -1
View File
@@ -727,7 +727,7 @@ class CheckedTreeTest(unittest.TestCase):
planted = self.tree("planted", {"src/lib.rs": "fn a() { 1 }\n#[cfg(test)]\nmod tests { fn t() { a() } }\n", "src/other.rs": "fn b() { 1 }\n"})
copy = self.tree("copy", {"src/lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests {}\n", "src/other.rs": "fn b() { 2 }\n", "src/new.rs": "#[cfg(test)]\nmod mine {}\nfn c() {}\n"})
checked_tree(planted, copy, str(self.root / "check"))
self.assertEqual(self.held("check"), {"src/lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests { fn t() { a() } }\n", "src/other.rs": "fn b() { 2 }\n", "src/new.rs": "#[cfg(test)]\nmod mine {}\nfn c() {}\n"})
self.assertEqual(self.held("check"), {"src/lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests { fn t() { a() } }\n", "src/other.rs": "fn b() { 2 }\n", "src/new.rs": "\nfn c() {}\n"})
def test_takes_the_planted_rust_file_where_the_fix_deleted_its_test_module(self):
planted = self.tree("planted", {"src/lib.rs": "fn a() { 1 }\n#[cfg(test)]\nmod tests { fn t() {} }\n"})
@@ -742,6 +742,15 @@ class CheckedTreeTest(unittest.TestCase):
checked_tree(planted, copy, str(self.root / "check"))
self.assertEqual((os.readlink(self.root / "check/z.rs"), self.held("check")["a.txt"]), ("a.txt", "text"))
def test_a_task_with_acceptance_tests_takes_its_rust_test_modules_as_fixed(self):
planted = self.tree("planted", {"lib.rs": "fn a() { 1 }\n#[cfg(test)]\nmod tests { fn old() {} }\n"})
copy = self.tree("copy", {"lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests { fn new() {} }\n"})
acceptance = self.tree("acceptance", {"tests/feature.rs": "accepts"})
main.check_made(planted, copy, str(self.root / "kept"), None)
main.check_made(planted, copy, str(self.root / "check"), acceptance)
self.assertEqual(self.held("kept"), {"lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests { fn old() {} }\n"})
self.assertEqual(self.held("check"), {"lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests { fn new() {} }\n", "tests/feature.rs": "accepts"})
def test_copies_a_link_as_a_link(self):
planted = self.tree("planted", {"calc.go": "bug"})
copy = self.tree("copy", {"calc.go": "fixed"})