summaryrefslogtreecommitdiffstats
path: root/tests/core/variant/test_variant.h
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-10-21 16:39:05 -0500
committerThaddeus Crews <repiteo@outlook.com>2024-10-21 16:39:05 -0500
commit5fb22327eeeb230328dca8b7016e36a1c9aad740 (patch)
treeeb46860eb99a472ad645b312a4437c8942337a3e /tests/core/variant/test_variant.h
parent5e65747d90411d58da46dd1a0dd0385280ff57ac (diff)
parent610635e1c8d8940397723052088979d16aa30a40 (diff)
downloadredot-engine-5fb22327eeeb230328dca8b7016e36a1c9aad740.tar.gz
Merge pull request #97542 from AThousandShips/dict_sort_fix
[Core] Fix sorting of `Dictionary` keys
Diffstat (limited to 'tests/core/variant/test_variant.h')
-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 be615975f8..599a282b20 100644
--- a/tests/core/variant/test_variant.h
+++ b/tests/core/variant/test_variant.h
@@ -1806,6 +1806,14 @@ TEST_CASE("[Variant] Writer and parser dictionary") {
CHECK_MESSAGE(d_parsed == Variant(d), "Should parse back.");
}
+TEST_CASE("[Variant] Writer key sorting") {
+ Dictionary d = build_dictionary(StringName("C"), 3, "A", 1, StringName("B"), 2, "D", 4);
+ String d_str;
+ VariantWriter::write_to_string(d, d_str);
+
+ CHECK_EQ(d_str, "{\n\"A\": 1,\n&\"B\": 2,\n&\"C\": 3,\n\"D\": 4\n}");
+}
+
TEST_CASE("[Variant] Writer recursive dictionary") {
// There is no way to accurately represent a recursive dictionary,
// the only thing we can do is make sure the writer doesn't blow up