1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

AK: Destroy original value when assigning to Variant

This commit is contained in:
Daniel Bertalan 2021-07-03 17:12:12 +02:00 committed by Ali Mohammad Pur
parent 515e2d9734
commit 39dd13fd17
2 changed files with 12 additions and 0 deletions

View file

@ -57,6 +57,12 @@ TEST_CASE(destructor)
Variant<DestructionChecker> test_variant { DestructionChecker { was_destroyed } };
}
EXPECT(was_destroyed);
bool was_destroyed_when_assigned_to = false;
Variant<DestructionChecker, int> original { DestructionChecker { was_destroyed_when_assigned_to } };
Variant<DestructionChecker, int> other { 42 };
original = other;
EXPECT(was_destroyed_when_assigned_to);
}
TEST_CASE(move_moves)