test(core): the gate's call and field probes

The stricter call matcher and the field check were fixed in code but had
no self-test, so a regression could hide behind the gate's own pass. These
probe them directly: x.take(5), a bare mention and other::take( are not
calls, kernel::take( is; Iif::form_4797 and TaxSummary::changes are the
other type's items and must not resolve, while each type's own fields and
methods do.

The made-up-name probe also gains NaiveDate::NoSuchThing and the two bogus
prefixes, and the `tests` probe now says plainly that bare `tests` resolves
as a Rust item (`mod tests`), not as a crate.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
This commit is contained in:
swaitsandDeepSeek V4.1 Flash committed 2026-11-08 22:35:01 -07:00
1 parent 4d3444c0af
commit c784bfe1d4
1 file changed
+48
@@ -2563,6 +2563,54 @@ fn made_up_names_do_not_resolve() {
);
}
/// `calls` finds a call, never a mention: a method call, a bare mention, or
/// another module's function of the same name is not the kernel's call.
#[test]
fn calls_finds_a_call_not_a_mention() {
assert!(
!calls("x.take(5)", "take"),
"a method call is not the kernel's"
);
assert!(!calls("take", "take"), "a bare mention is not a call");
assert!(
!calls("other::take(5)", "take"),
"another module's take is not the kernel's"
);
assert!(calls("kernel::take(5)", "take"), "a kernel call counts");
assert!(calls("take(5)", "take"), "an imported bare call counts");
assert!(calls("kernel::Direction::flip(d)", "Direction::flip"));
assert!(
!calls("kernel::Direction::flip(d)", "flip"),
"a type's flip is not the free flip"
);
}
/// A field belongs to its own type, and a method to its own type: a field
/// of `Iif` never backs `TaxSummary::…`, nor the reverse.
#[test]
fn a_field_belongs_to_its_own_type() {
let root = repo_root();
let (defs, bases, all_paths) = main_index(&root);
for token in [
"Iif::changes",
"Iif::receivable_payable",
"Iif::warnings",
"TaxSummary::form_4797",
] {
assert_eq!(
resolve(token, &defs, &bases, &all_paths),
Ok(Class::RustItem),
"`{token}` is a real item of its type"
);
}
for token in ["Iif::form_4797", "TaxSummary::changes"] {
assert!(
resolve(token, &defs, &bases, &all_paths).is_err(),
"`{token}` is a field of the other type and must not resolve"
);
}
}
#[test]
fn a_harness_listed_twice_must_agree() {
let mut laws = BTreeMap::new();