Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

test: pin Solidity modifier_invocation decorator tracking (#2090)

Sanskar gupta7036c4d59962
diff --git a/tests/test_extraction.c b/tests/test_extraction.c
index cb01dcf14..a3610c207 100644
--- a/tests/test_extraction.c
+++ b/tests/test_extraction.c
@@ -3999,6 +3999,25 @@ TEST(extract_java_method_annotations_issue382) {
PASS();
}
+/* Issue #2090: Solidity modifier_invocation tracked as decorator. */
+TEST(solidity_modifier_decorator) {
+ CBMFileResult *r = extract("pragma solidity ^0.8.0;\n"
+ "contract Vault {\n"
+ " modifier onlyOwner() { _; }\n"
+ " function withdraw() public onlyOwner {\n"
+ " }\n"
+ "}\n",
+ CBM_LANG_SOLIDITY, "t", "Vault.sol");
+ ASSERT_NOT_NULL(r);
+ ASSERT_FALSE(r->has_error);
+ const CBMDefinition *m = find_def_by_name(r, "withdraw");
+ ASSERT_NOT_NULL(m);
+ ASSERT(decorators_contain(m, "onlyOwner"));
+ cbm_free_result(r);
+ PASS();
+}
+
+
/* ── ArkTS (HarmonyOS .ets) ─────────────────────────────────────── */
TEST(arkts_component_struct) {
@@ -7445,6 +7464,7 @@ SUITE(extraction) {
RUN_TEST(js_index_module_qn_not_collide_with_folder);
RUN_TEST(python_regular_module_qn_unchanged);
RUN_TEST(extract_java_method_annotations_issue382);
+ RUN_TEST(solidity_modifier_decorator);
RUN_TEST(arkts_component_struct);
RUN_TEST(arkts_exported_struct_decorators);
RUN_TEST(arkts_member_decorators);