mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
StringMap: Test and finish off supporting perfectly forwarded values in StringMap operations.
Followup to r221946. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221958 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -256,9 +256,15 @@ TEST_F(StringMapTest, NonDefaultConstructable) {
|
||||
ASSERT_EQ(iter->second.i, 123);
|
||||
}
|
||||
|
||||
struct Immovable {
|
||||
Immovable() {}
|
||||
Immovable(Immovable&&) LLVM_DELETED_FUNCTION; // will disable the other special members
|
||||
};
|
||||
|
||||
struct MoveOnly {
|
||||
int i;
|
||||
MoveOnly(int i) : i(i) {}
|
||||
MoveOnly(const Immovable&) : i(0) {}
|
||||
MoveOnly(MoveOnly &&RHS) : i(RHS.i) {}
|
||||
MoveOnly &operator=(MoveOnly &&RHS) {
|
||||
i = RHS.i;
|
||||
@@ -270,7 +276,7 @@ private:
|
||||
MoveOnly &operator=(const MoveOnly &) LLVM_DELETED_FUNCTION;
|
||||
};
|
||||
|
||||
TEST_F(StringMapTest, MoveOnlyKey) {
|
||||
TEST_F(StringMapTest, MoveOnly) {
|
||||
StringMap<MoveOnly> t;
|
||||
t.GetOrCreateValue("Test", MoveOnly(42));
|
||||
StringRef Key = "Test";
|
||||
@@ -278,6 +284,14 @@ TEST_F(StringMapTest, MoveOnlyKey) {
|
||||
->Destroy();
|
||||
}
|
||||
|
||||
TEST_F(StringMapTest, CtorArg) {
|
||||
StringMap<MoveOnly> t;
|
||||
t.GetOrCreateValue("Test", Immovable());
|
||||
StringRef Key = "Test";
|
||||
StringMapEntry<MoveOnly>::Create(Key, Immovable())
|
||||
->Destroy();
|
||||
}
|
||||
|
||||
TEST_F(StringMapTest, MoveConstruct) {
|
||||
StringMap<int> A;
|
||||
A.GetOrCreateValue("x", 42);
|
||||
|
Reference in New Issue
Block a user