Skip to content

Commit c421344

Browse files
committed
Add more test cases
1 parent a993303 commit c421344

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

clang/unittests/Tooling/RangeSelectorTest.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,15 @@ TEST(RangeSelectorTest, MergeOp) {
338338
RangeSelector R = merge(node("a0"), node("a1"));
339339
TestMatch Match = matchCode(Code, Matcher);
340340
EXPECT_THAT_EXPECTED(select(R, Match), HasValue("3, 7"));
341-
R = merge(node("a2"), node("a1"));
342-
EXPECT_THAT_EXPECTED(select(R, Match), HasValue("7 /* comment */, 9"));
341+
// Test the merge of two non-contiguous and out-of-order token-ranges.
342+
R = merge(node("a2"), node("a0"));
343+
EXPECT_THAT_EXPECTED(select(R, Match), HasValue("3, 7 /* comment */, 9"));
344+
// Test the merge of a token-range (expr node) with a char-range (before).
345+
R = merge(node("a1"), before(node("a0")));
346+
EXPECT_THAT_EXPECTED(select(R, Match), HasValue("3, 7"));
347+
// Test the merge of two char-ranges.
348+
R = merge(before(node("a0")), before(node("a1")));
349+
EXPECT_THAT_EXPECTED(select(R, Match), HasValue("3, "));
343350
}
344351

345352
TEST(RangeSelectorTest, MergeOpParsed) {

0 commit comments

Comments
 (0)