Replace lexical Rust fragments with real modules
This commit is contained in:
parent
f8849cdb5f
commit
247819250b
1 changed files with 3302 additions and 2671 deletions
|
|
@ -224,6 +224,39 @@ class VerificationTests(unittest.TestCase):
|
|||
finally:
|
||||
VERIFY.RUST_FILE_SIZE_EXCEPTIONS = original
|
||||
|
||||
def test_rust_module_boundary_audit_rejects_lexical_include(self) -> None:
|
||||
with tempfile.TemporaryDirectory(dir=ROOT) as directory:
|
||||
package_root = Path(directory)
|
||||
(package_root / "lib.rs").write_text('include!("fragment.rs");\n')
|
||||
metadata = {
|
||||
"workspace_members": ["outside"],
|
||||
"packages": [
|
||||
{
|
||||
"id": "outside",
|
||||
"manifest_path": str(package_root / "Cargo.toml"),
|
||||
}
|
||||
],
|
||||
"target_directory": str(ROOT / "target"),
|
||||
}
|
||||
with self.assertRaisesRegex(VERIFY.VerificationError, "lexical include"):
|
||||
VERIFY.audit_rust_module_boundaries(metadata)
|
||||
|
||||
def test_rust_module_boundary_audit_accepts_real_modules(self) -> None:
|
||||
with tempfile.TemporaryDirectory(dir=ROOT) as directory:
|
||||
package_root = Path(directory)
|
||||
(package_root / "lib.rs").write_text("mod fragment;\n")
|
||||
metadata = {
|
||||
"workspace_members": ["outside"],
|
||||
"packages": [
|
||||
{
|
||||
"id": "outside",
|
||||
"manifest_path": str(package_root / "Cargo.toml"),
|
||||
}
|
||||
],
|
||||
"target_directory": str(ROOT / "target"),
|
||||
}
|
||||
VERIFY.audit_rust_module_boundaries(metadata)
|
||||
|
||||
def test_rust_file_size_exceptions_are_exact_and_current(self) -> None:
|
||||
metadata = VERIFY.workspace_metadata()
|
||||
original = VERIFY.RUST_FILE_SIZE_EXCEPTIONS
|
||||
|
|
|
|||
Loading…
Reference in a new issue