Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(process-statics): cover macro token boundaries and literal statics

Steven Enamakel1144e17f6ead
diff --git a/scripts/__tests__/process-statics.test.mjs b/scripts/__tests__/process-statics.test.mjs
index 05dbfb264b..94dcdace1d 100644
--- a/scripts/__tests__/process-statics.test.mjs
+++ b/scripts/__tests__/process-statics.test.mjs
@@ -307,3 +307,22 @@ test("repository scan reads the merge base, enforces records, and fails without
rmSync(root, { recursive: true, force: true });
}
});
+
+ test("type macro token boundaries cannot reuse an earlier ownership signature", () => {
+ for (const [beforeTokens, afterTokens] of [
+ ["a b", "ab"], ["a/**/b", "ab"], ["1 u8", "1u8"],
+ ['b "x"', 'b"x"'], ["> >", ">>"], ["r #ident", "r#ident"],
+ ]) {
+ const before = scan(`static X: ty!(${beforeTokens}) = x;`);
+ const after = scan(`static X: ty!(${afterTokens}) = x;`);
+ assert.notEqual(before[0].type, after[0].type, beforeTokens);
+ assert.equal(reviewChanges(before, after, []).length, 1);
+ }
+});
+
+test("literal static declarations in macro templates require source ownership review", () => {
+ const before = scan("pub fn example() {}");
+ const after = scan("macro_rules! make_cache { () => { static CACHE: OnceLock<Map> = x; }; }");
+ assert.equal(after.length, 1);
+ assert.equal(reviewChanges(before, after, []).length, 1);
+});