Skip to content

Commit

Permalink
test: Outline for symbols generated by macros
Browse files Browse the repository at this point in the history
  • Loading branch information
slavek-kucera authored Jan 30, 2023
1 parent 38d0bcc commit 4536842
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion parser_library/test/lsp/lsp_context_document_symbol_ord_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1153,4 +1153,63 @@ SECT DSECT
EXPECT_LE(recursive_counter(outline), 100);
ASSERT_FALSE(outline.empty());
EXPECT_EQ(outline.front().name, "Outline may be truncated");
}
}

TEST(lsp_context_document_symbol, generated_symbols)
{
std::string input =
R"(
MACRO
MAC
&I SETA 0
.LOOP ANOP
&LINE AREAD
&L SETC '&LINE'(1,1)
&IN SETC '&LINE'(10,6)
&OPS SETC '&LINE'(16,*)
&L &IN &OPS
&I SETA &I+1
AIF (&I LT 3).LOOP
MEND
MAC
C CSECT
A DS F
B DS F
END
)";
analyzer a(input);
a.analyze();

EXPECT_TRUE(a.diags().empty());

const auto limit = 1000LL;
document_symbol_list_s outline = a.context().lsp_ctx->document_symbol(empty_loc, limit);
document_symbol_list_s expected = document_symbol_list_s {
document_symbol_item_s {
"MAC",
document_symbol_kind::MACRO,
range { { 14, 9 }, { 14, 9 } },
document_symbol_list_s {
document_symbol_item_s {
"C",
document_symbol_kind::EXECUTABLE,
range { { 14, 9 }, { 14, 9 } },
document_symbol_list_s {
document_symbol_item_s {
"A",
document_symbol_kind::DAT,
range { { 14, 9 }, { 14, 9 } },
},
document_symbol_item_s {
"B",
document_symbol_kind::DAT,
range { { 14, 9 }, { 14, 9 } },
},
},
},
},
},
};
EXPECT_TRUE(is_similar(outline, expected));
}

0 comments on commit 4536842

Please sign in to comment.