Answer stability round 1: 1 🔴, 1 🟡 (0 misread); a fix that drops a test file's declaration gets the planted file, and any file may stand beside or under its declarer
This commit is contained in:
@@ -168,11 +168,12 @@ def checked_tree(planted: str, copy: str, into: str, rust_tests_planted: bool =
|
||||
"""Makes at `into` the tree the tests check a fix in: `planted`, the code with the bug as Haiku got it, with each file that is no
|
||||
test as `copy` holds it after the fix. So a test Haiku changed, removed or added doesn't count, and neither does a file under
|
||||
a `testdata` folder, where Go's tests keep the output they expect. Where rust_tests_planted, a Rust file's inline `#[cfg(test)]`
|
||||
modules stand as the planted file has them too, as `with_tests_of` says, and so does each Rust file that `rust_test_files` finds.
|
||||
modules stand as the planted file has them too, as `with_tests_of` says, and so does each file that `rust_test_files` finds in
|
||||
the planted tree.
|
||||
|
||||
Raises OSError where a file cannot be copied."""
|
||||
shutil.copytree(planted, into, symlinks=True)
|
||||
# `rust_test_files` is None for a tree whose declarations it cannot resolve, which the bench passes over where it plants the bug.
|
||||
# `rust_test_files` is None for a tree with a declaration whose file it can't find, and the bench plants no bug in such a tree.
|
||||
rust_tests = (rust_test_files(planted) or set()) if rust_tests_planted else set()
|
||||
before, after = set(entries(planted)), set(entries(copy))
|
||||
for path in before - after:
|
||||
@@ -209,8 +210,8 @@ def of_tests(path: str, rust_tests: typing.AbstractSet[str] = frozenset()) -> bo
|
||||
|
||||
|
||||
def rust_test_files(tree: str) -> set[str] | None:
|
||||
"""The Rust files under tree that a `#[cfg(test)] mod name;` declaration names, by their paths from tree. None where a
|
||||
declaration names no file there, or `declared` cannot tell a file's declarations.
|
||||
"""The Rust files under tree that a `#[cfg(test)] mod name;` declaration names, by their paths from tree. None where a declaration
|
||||
names no file there, or a string or comment of a Rust file is never closed: the tree may hold a test file this can't find.
|
||||
|
||||
Raises OSError where a file cannot be read."""
|
||||
files = set(entries(tree))
|
||||
@@ -222,10 +223,10 @@ def rust_test_files(tree: str) -> set[str] | None:
|
||||
if names is None:
|
||||
return None
|
||||
for name in names:
|
||||
standing = [home for home in homes(path, name) if home in files]
|
||||
standing = files.intersection(homes(path, name))
|
||||
if not standing:
|
||||
return None
|
||||
found.add(standing[0])
|
||||
found |= standing
|
||||
return found
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user