summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/10_keys
diff options
context:
space:
mode:
Diffstat (limited to 'tests/custom/03_stdlib/10_keys')
-rw-r--r--tests/custom/03_stdlib/10_keys21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/custom/03_stdlib/10_keys b/tests/custom/03_stdlib/10_keys
new file mode 100644
index 0000000..46462a0
--- /dev/null
+++ b/tests/custom/03_stdlib/10_keys
@@ -0,0 +1,21 @@
+The `keys()` function returns an array containing all keys of the given
+dictionary value. The keys are sorted in declaration order.
+
+-- Testcase --
+{{ keys({ "foo": true, "bar": false, "qrx": 123 }) }}
+-- End --
+
+-- Expect stdout --
+[ "foo", "bar", "qrx" ]
+-- End --
+
+
+If the given argument is not a dictionary, the function returns `null`.
+
+-- Testcase --
+{{ keys(true) === null }}
+-- End --
+
+-- Expect stdout --
+true
+-- End --