aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/StringMapTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/ADT/StringMapTest.cpp')
-rw-r--r--llvm/unittests/ADT/StringMapTest.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/unittests/ADT/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp
index 6a3cca5..f38a604 100644
--- a/llvm/unittests/ADT/StringMapTest.cpp
+++ b/llvm/unittests/ADT/StringMapTest.cpp
@@ -308,7 +308,21 @@ TEST_F(StringMapTest, InsertOrAssignTest) {
EXPECT_EQ(0, try1.first->second.copy);
}
-TEST_F(StringMapTest, IterMapKeys) {
+TEST_F(StringMapTest, IterMapKeysVector) {
+ StringMap<int> Map;
+ Map["A"] = 1;
+ Map["B"] = 2;
+ Map["C"] = 3;
+ Map["D"] = 3;
+
+ std::vector<StringRef> Keys{Map.keys().begin(), Map.keys().end()};
+ llvm::sort(Keys);
+
+ std::vector<StringRef> Expected{{"A", "B", "C", "D"}};
+ EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringMapTest, IterMapKeysSmallVector) {
StringMap<int> Map;
Map["A"] = 1;
Map["B"] = 2;