Answer stability round 2: 0 🔴, 1 🟡 (0 misread); keep a Rust file whose modules cannot be told apart as Haiku left it where the planted file has no module
CI / tests (pull_request) Successful in 6m22s
CI / tests (pull_request) Successful in 6m22s
This commit is contained in:
@@ -30,9 +30,9 @@ No model judges anything: the bench runs programs, and reads Haiku's own stream.
|
|||||||
reaches api.anthropic.com and nothing else. A fix ends after 30 minutes.
|
reaches api.anthropic.com and nothing else. A fix ends after 30 minutes.
|
||||||
- Check. The test command runs over the planted tree with each file that is no test as Haiku left it; a fix passes where it exits 0.
|
- Check. The test command runs over the planted tree with each file that is no test as Haiku left it; a fix passes where it exits 0.
|
||||||
A test Haiku changed, removed or added doesn't count, and neither does a file under a `testdata` folder. In a Rust file, each
|
A test Haiku changed, removed or added doesn't count, and neither does a file under a `testdata` folder. In a Rust file, each
|
||||||
inline `#[cfg(test)]` module stands as the planted file has it, and the rest is as Haiku left it. Where Haiku's file lacks one of
|
inline `#[cfg(test)]` module stands as the planted file has it, and the rest is as Haiku left it. Where the planted file has such
|
||||||
those modules, or its modules cannot be told apart, the planted file stands whole; where the planted file's cannot be told apart,
|
modules and Haiku's file lacks one of them, or its modules cannot be told apart, the planted file stands whole; where the planted
|
||||||
Haiku's stands. A Rust mutant whose file's modules cannot be told apart, as where two share a name or a brace, string or comment
|
file has none, or its modules cannot be told apart, Haiku's stands. A Rust mutant whose file's modules cannot be told apart, as where two share a name or a brace, string or comment
|
||||||
is never closed, is passed over. A Rust test in a file of its own, as `#[cfg(test)] mod tests;` names, counts, since the bench
|
is never closed, is passed over. A Rust test in a file of its own, as `#[cfg(test)] mod tests;` names, counts, since the bench
|
||||||
tells no such file from code.
|
tells no such file from code.
|
||||||
|
|
||||||
|
|||||||
@@ -81,10 +81,11 @@ def with_tests_of(planted: bytes, copy: bytes) -> bytes:
|
|||||||
"""copy with each of its test modules replaced by the one of that name in planted, and each that planted lacks left out. So a test a
|
"""copy with each of its test modules replaced by the one of that name in planted, and each that planted lacks left out. So a test a
|
||||||
fix changed, removed or added doesn't count.
|
fix changed, removed or added doesn't count.
|
||||||
|
|
||||||
Where planted's modules cannot be told apart, copy is returned as it is. Where copy's cannot, or copy lacks one of planted's,
|
Where planted's modules cannot be told apart, or planted has none and copy's cannot be told apart, copy is returned as it is. Where
|
||||||
planted is returned: Haiku's file has no module to put them in."""
|
planted has some and copy's cannot be told apart, or copy lacks one of planted's, planted is returned: Haiku's file has no module
|
||||||
|
to put them in."""
|
||||||
before, after = modules(planted), modules(copy)
|
before, after = modules(planted), modules(copy)
|
||||||
if before is None:
|
if before is None or (after is None and not before):
|
||||||
return copy
|
return copy
|
||||||
if after is None or before.keys() - after.keys():
|
if after is None or before.keys() - after.keys():
|
||||||
return planted
|
return planted
|
||||||
|
|||||||
@@ -143,6 +143,11 @@ class WithTestsOfTest(unittest.TestCase):
|
|||||||
def test_takes_the_planted_file_where_the_fixed_modules_cannot_be_told_apart(self):
|
def test_takes_the_planted_file_where_the_fixed_modules_cannot_be_told_apart(self):
|
||||||
self.assertEqual(with_tests_of(LIB, "fn broken() {"), LIB)
|
self.assertEqual(with_tests_of(LIB, "fn broken() {"), LIB)
|
||||||
|
|
||||||
|
def test_takes_the_file_as_fixed_where_planted_has_no_module_and_the_fixed_modules_cannot_be_told_apart(self):
|
||||||
|
for planted in ("", "fn a() {}\n"):
|
||||||
|
with self.subTest(planted=planted):
|
||||||
|
self.assertEqual(with_tests_of(planted, "fn broken() {"), "fn broken() {")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -735,6 +735,13 @@ class CheckedTreeTest(unittest.TestCase):
|
|||||||
checked_tree(planted, copy, str(self.root / "check"))
|
checked_tree(planted, copy, str(self.root / "check"))
|
||||||
self.assertEqual(self.held("check"), {"src/lib.rs": "fn a() { 1 }\n#[cfg(test)]\nmod tests { fn t() {} }\n"})
|
self.assertEqual(self.held("check"), {"src/lib.rs": "fn a() { 1 }\n#[cfg(test)]\nmod tests { fn t() {} }\n"})
|
||||||
|
|
||||||
|
def test_takes_a_rust_file_the_fix_added_as_it_is_where_its_modules_cannot_be_told_apart(self):
|
||||||
|
planted = self.tree("planted", {"src/lib.rs": "fn a() {}\n"})
|
||||||
|
added = "#[cfg(test)]\nmod tests {}\nfn b() { #[cfg(test)] mod tests {} }\n"
|
||||||
|
copy = self.tree("copy", {"src/lib.rs": "fn a() {}\n", "src/new.rs": added})
|
||||||
|
checked_tree(planted, copy, str(self.root / "check"))
|
||||||
|
self.assertEqual(self.held("check")["src/new.rs"], added)
|
||||||
|
|
||||||
def test_leaves_a_rust_link_as_a_link_whatever_it_points_at(self):
|
def test_leaves_a_rust_link_as_a_link_whatever_it_points_at(self):
|
||||||
planted = self.tree("planted", {"z.rs": "fn a() {}\n#[cfg(test)]\nmod tests {}\n", "a.txt": "text"})
|
planted = self.tree("planted", {"z.rs": "fn a() {}\n#[cfg(test)]\nmod tests {}\n", "a.txt": "text"})
|
||||||
copy = self.tree("copy", {"a.txt": "text"})
|
copy = self.tree("copy", {"a.txt": "text"})
|
||||||
|
|||||||
Reference in New Issue
Block a user