Skip to content

Commit 269df33

Browse files
committed
add a unit test for the new prefix mapping transform function
1 parent c24fa98 commit 269df33

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/unittests/Support/PrefixMapperTest.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,21 @@ TEST(MappedPrefixTest, transformJoinedIfValid) {
125125
EXPECT_EQ(ArrayRef(ExpectedSplit), ArrayRef(ComputedSplit));
126126
}
127127

128+
TEST(PrefixMapperTest, transformPairs) {
129+
SmallVector<std::pair<std::string, std::string>> PrefixMappings = {
130+
{"", ""}, {"a", "b"}, {"", "a"}, {"a", ""}, {"=a=b=", "=c=d==="}
131+
};
132+
MappedPrefix ExpectedSplit[] = {
133+
MappedPrefix{"", ""}, MappedPrefix{"a", "b"},
134+
MappedPrefix{"", "a"}, MappedPrefix{"a", ""},
135+
MappedPrefix{"=a=b=", "=c=d==="},
136+
};
137+
138+
SmallVector<MappedPrefix> ComputedSplit;
139+
MappedPrefix::transformPairs(PrefixMappings, ComputedSplit);
140+
EXPECT_EQ(ArrayRef(ExpectedSplit), ArrayRef(ComputedSplit));
141+
}
142+
128143
TEST(PrefixMapperTest, construct) {
129144
for (auto PathStyle : {
130145
sys::path::Style::posix,

0 commit comments

Comments
 (0)