aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-05-29 01:12:12 +0200
committerGitHub <noreply@github.com>2022-05-29 01:12:12 +0200
commit14060bf92d5a848930f4968d455922f5bafea813 (patch)
treefc0b1b0b2bc10fc289e62a20afb7f47c29b67d27 /tests
parentfeat(ltex): use platform independent dist if java is installed (#730) (diff)
downloadmason-14060bf92d5a848930f4968d455922f5bafea813.tar
mason-14060bf92d5a848930f4968d455922f5bafea813.tar.gz
mason-14060bf92d5a848930f4968d455922f5bafea813.tar.bz2
mason-14060bf92d5a848930f4968d455922f5bafea813.tar.lz
mason-14060bf92d5a848930f4968d455922f5bafea813.tar.xz
mason-14060bf92d5a848930f4968d455922f5bafea813.tar.zst
mason-14060bf92d5a848930f4968d455922f5bafea813.zip
refactor(health): spawn processes via the spawn module (#732)
Diffstat (limited to 'tests')
-rw-r--r--tests/core/functional/list_spec.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/core/functional/list_spec.lua b/tests/core/functional/list_spec.lua
index 5d90650a..9ab7be6f 100644
--- a/tests/core/functional/list_spec.lua
+++ b/tests/core/functional/list_spec.lua
@@ -102,4 +102,15 @@ describe("functional: list", function()
[fnkey] = 1,
}, _.zip_table({ "a", fnkey }, { "a", 1 }))
end)
+
+ it("should get nth item", function()
+ assert.equals("first", _.nth(1, { "first", "middle", "last" }))
+ assert.equals("last", _.nth(-1, { "first", "middle", "last" }))
+ assert.equals("middle", _.nth(-2, { "first", "middle", "last" }))
+ assert.equals("a", _.nth(1, "abc"))
+ assert.equals("c", _.nth(-1, "abc"))
+ assert.equals("b", _.nth(-2, "abc"))
+ assert.is_nil(_.nth(0, { "value" }))
+ assert.equals("", _.nth(0, "abc"))
+ end)
end)