Skip to content

Commit 8f879f8

Browse files
committed
[NFC][SpecialCaseList] Add unit test for line numbers
1 parent 4793e84 commit 8f879f8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

llvm/unittests/Support/SpecialCaseListTest.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,4 +306,24 @@ TEST_F(SpecialCaseListTest, Version2) {
306306
EXPECT_TRUE(SCL->inSection("sect2", "fun", "bar"));
307307
EXPECT_FALSE(SCL->inSection("sect3", "fun", "bar"));
308308
}
309+
310+
TEST_F(SpecialCaseListTest, LinesInSection) {
311+
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("fun:foo\n"
312+
"fun:bar\n"
313+
"fun:foo\n");
314+
// FIXME: Get the last one for #139128.
315+
EXPECT_EQ(1u, SCL->inSectionBlame("sect1", "fun", "foo"));
316+
EXPECT_EQ(2u, SCL->inSectionBlame("sect1", "fun", "bar"));
317+
}
318+
319+
TEST_F(SpecialCaseListTest, LinesCrossSection) {
320+
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("fun:foo\n"
321+
"fun:bar\n"
322+
"fun:foo\n"
323+
"[sect1]\n"
324+
"fun:bar\n");
325+
// FIXME: Get the last one for #139128.
326+
EXPECT_EQ(1u, SCL->inSectionBlame("sect1", "fun", "foo"));
327+
EXPECT_EQ(2u, SCL->inSectionBlame("sect1", "fun", "bar"));
328+
}
309329
}

0 commit comments

Comments
 (0)