summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDmitrii Maganov <vonagam@gmail.com>2023-02-24 22:58:00 +0200
committerDmitrii Maganov <vonagam@gmail.com>2023-02-24 23:33:29 +0200
commitc5f7a89b0f557c9540fa2c6af2cbb3a0fb5096a3 (patch)
treeb61bf00295059a99d78486d03030422463e3d89a /tests
parent6296b46008fb8d8e5cb9b60af05fa1ea26b8f600 (diff)
Core: Identity compare objects by id, not by pointers
Diffstat (limited to 'tests')
-rw-r--r--tests/core/variant/test_variant.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/core/variant/test_variant.h b/tests/core/variant/test_variant.h
index dfbaa36af8..024fcf53c4 100644
--- a/tests/core/variant/test_variant.h
+++ b/tests/core/variant/test_variant.h
@@ -1056,6 +1056,14 @@ TEST_CASE("[Variant] Identity comparison") {
Variant obj_null_two_var = Variant((Object *)nullptr);
CHECK(obj_null_one_var.identity_compare(obj_null_one_var));
CHECK(obj_null_one_var.identity_compare(obj_null_two_var));
+
+ Object *freed_one = new Object();
+ Variant freed_one_var = freed_one;
+ delete freed_one;
+ Object *freed_two = new Object();
+ Variant freed_two_var = freed_two;
+ delete freed_two;
+ CHECK_FALSE(freed_one_var.identity_compare(freed_two_var));
}
TEST_CASE("[Variant] Nested array comparison") {