mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
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. llvm-svn: 198377
This commit is contained in:
parent
05d9569f03
commit
3036d7607c
@ -203,4 +203,19 @@ TEST_F(StringMapTest, InsertTest) {
|
||||
assertSingleItemMap();
|
||||
}
|
||||
|
||||
// Create a non-default constructable value
|
||||
TEST_F(StringMapTest, NonDefaultConstructable) {
|
||||
struct StringMapTestStruct {
|
||||
StringMapTestStruct(int i) : i(i) {}
|
||||
StringMapTestStruct() LLVM_DELETED_FUNCTION;
|
||||
int i;
|
||||
};
|
||||
|
||||
StringMap<StringMapTestStruct> t;
|
||||
t.GetOrCreateValue("Test", StringMapTestStruct(123));
|
||||
StringMap<StringMapTestStruct>::iterator iter = t.find("Test");
|
||||
ASSERT_NE(iter, t.end());
|
||||
ASSERT_EQ(iter->second.i, 123);
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
Loading…
Reference in New Issue
Block a user