diff options
| author | William Boman <william@redwill.se> | 2023-01-10 17:53:17 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-10 17:53:17 +0100 |
| commit | c609775d1fc5ae18aadc92b8b65be9c9b1980004 (patch) | |
| tree | f80d8b3153446cb33b9506ce34db4614dc249b53 /tests | |
| parent | chore: update generated code (#881) (diff) | |
| download | mason-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.lua | 13 |
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() |
