aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2023-01-10 17:53:17 +0100
committerGitHub <noreply@github.com>2023-01-10 17:53:17 +0100
commitc609775d1fc5ae18aadc92b8b65be9c9b1980004 (patch)
treef80d8b3153446cb33b9506ce34db4614dc249b53 /tests
parentchore: update generated code (#881) (diff)
downloadmason-c609775d1fc5ae18aadc92b8b65be9c9b1980004.tar
mason-c609775d1fc5ae18aadc92b8b65be9c9b1980004.tar.gz
mason-c609775d1fc5ae18aadc92b8b65be9c9b1980004.tar.bz2
mason-c609775d1fc5ae18aadc92b8b65be9c9b1980004.tar.lz
mason-c609775d1fc5ae18aadc92b8b65be9c9b1980004.tar.xz
mason-c609775d1fc5ae18aadc92b8b65be9c9b1980004.tar.zst
mason-c609775d1fc5ae18aadc92b8b65be9c9b1980004.zip
feat(functional): add list.index_by (#882)
Diffstat (limited to 'tests')
-rw-r--r--tests/mason-core/functional/list_spec.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/mason-core/functional/list_spec.lua b/tests/mason-core/functional/list_spec.lua
index 043f058b..6b2aa2d2 100644
--- a/tests/mason-core/functional/list_spec.lua
+++ b/tests/mason-core/functional/list_spec.lua
@@ -279,6 +279,19 @@ describe("functional: list", function()
_.split_every(0, {})
end)
end)
+
+ it("should index_by lists", function()
+ assert.same(
+ {
+ apple = { fruit = "apple", color = "red" },
+ banana = { fruit = "banana", color = "yellow" },
+ },
+ _.index_by(_.prop "fruit", {
+ { fruit = "apple", color = "red" },
+ { fruit = "banana", color = "yellow" },
+ })
+ )
+ end)
end)
describe("list immutability", function()