Skip to content

Commit 7036c4d

Browse files
committed
test: pin Solidity modifier_invocation decorator tracking (#2090)
Signed-off-by: Sanskar gupta <[email protected]>
1 parent 6b56d78 commit 7036c4d

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎tests/test_extraction.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3999,6 +3999,25 @@ TEST(extract_java_method_annotations_issue382) {
39993999
PASS();
40004000
}
40014001

4002+
/* Issue #2090: Solidity modifier_invocation tracked as decorator. */
4003+
TEST(solidity_modifier_decorator) {
4004+
CBMFileResult *r = extract("pragma solidity ^0.8.0;\n"
4005+
"contract Vault {\n"
4006+
" modifier onlyOwner() { _; }\n"
4007+
" function withdraw() public onlyOwner {\n"
4008+
" }\n"
4009+
"}\n",
4010+
CBM_LANG_SOLIDITY, "t", "Vault.sol");
4011+
ASSERT_NOT_NULL(r);
4012+
ASSERT_FALSE(r->has_error);
4013+
const CBMDefinition *m = find_def_by_name(r, "withdraw");
4014+
ASSERT_NOT_NULL(m);
4015+
ASSERT(decorators_contain(m, "onlyOwner"));
4016+
cbm_free_result(r);
4017+
PASS();
4018+
}
4019+
4020+
40024021
/* ── ArkTS (HarmonyOS .ets) ─────────────────────────────────────── */
40034022

40044023
TEST(arkts_component_struct) {
@@ -7445,6 +7464,7 @@ SUITE(extraction) {
74457464
RUN_TEST(js_index_module_qn_not_collide_with_folder);
74467465
RUN_TEST(python_regular_module_qn_unchanged);
74477466
RUN_TEST(extract_java_method_annotations_issue382);
7467+
RUN_TEST(solidity_modifier_decorator);
74487468
RUN_TEST(arkts_component_struct);
74497469
RUN_TEST(arkts_exported_struct_decorators);
74507470
RUN_TEST(arkts_member_decorators);

0 commit comments

Comments
 (0)