llvm.org GIT mirror llvm / 4c9b681
Test coverage for non-default-constructible elements in a StringMap This functionality was enabled by r198374. Here's a test to ensure it works and we don't regress it. Based on a patch by Maciej Piechotka. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198377 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 5 years ago
1 changed file(s) with 15 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
202202 assertSingleItemMap();
203203 }
204204
205 // Create a non-default constructable value
206 TEST_F(StringMapTest, NonDefaultConstructable) {
207 struct StringMapTestStruct {
208 StringMapTestStruct(int i) : i(i) {}
209 StringMapTestStruct() LLVM_DELETED_FUNCTION;
210 int i;
211 };
212
213 StringMap t;
214 t.GetOrCreateValue("Test", StringMapTestStruct(123));
215 StringMap::iterator iter = t.find("Test");
216 ASSERT_NE(iter, t.end());
217 ASSERT_EQ(iter->second.i, 123);
218 }
219
205220 } // end anonymous namespace