aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Scholz <epirat07@gmail.com>2025-04-01 21:54:17 +0200
committerXavier Claessens <xclaesse@gmail.com>2025-08-29 17:36:44 -0400
commit36a47e91619fc47312ebcbf7b4832207ae46e017 (patch)
tree9e04254e08f4d9abae4d82abda130112e6ad6d41
parentfb6db4070e7a40ca701914fab6e8c31f65da89c4 (diff)
downloadmeson-36a47e91619fc47312ebcbf7b4832207ae46e017.zip
meson-36a47e91619fc47312ebcbf7b4832207ae46e017.tar.gz
meson-36a47e91619fc47312ebcbf7b4832207ae46e017.tar.bz2
tests: add tests for the dict.keys() method
-rw-r--r--test cases/common/188 dict/meson.build6
1 files changed, 6 insertions, 0 deletions
diff --git a/test cases/common/188 dict/meson.build b/test cases/common/188 dict/meson.build
index 2f4c4c9..a2b4ae8 100644
--- a/test cases/common/188 dict/meson.build
+++ b/test cases/common/188 dict/meson.build
@@ -16,12 +16,18 @@ endforeach
assert(i == 3, 'There should be three elements in that dictionary')
+# Test keys() works as expected (note that it sorts the keys)
+assert(dict.keys() == ['baz', 'foo', 'foo bar'], 'Keys returned unexpected list')
+
empty_dict = {}
foreach key, value : empty_dict
assert(false, 'This dict should be empty')
endforeach
+# Test keys() returns an empty list
+assert(empty_dict.keys() == [], 'Keys for an empty dict should be an empty list')
+
d1 = empty_dict + {'a' : 'b'}
assert(d1 == {'a' : 'b'}, 'dict addition is not working')