diff options
| author | William Boman <william@redwill.se> | 2022-12-19 11:21:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-19 10:21:24 +0000 |
| commit | 2db93f76da605bccada1be3b020f99b3a67ea791 (patch) | |
| tree | 22e6f8d2e75ab7a4d0ea7a9b316fa8e069608efb /tests/mason-core/functional/function_spec.lua | |
| parent | Revert "chore: use pwsh instead of powershell (#706)" (#769) (diff) | |
| download | mason-2db93f76da605bccada1be3b020f99b3a67ea791.tar mason-2db93f76da605bccada1be3b020f99b3a67ea791.tar.gz mason-2db93f76da605bccada1be3b020f99b3a67ea791.tar.bz2 mason-2db93f76da605bccada1be3b020f99b3a67ea791.tar.lz mason-2db93f76da605bccada1be3b020f99b3a67ea791.tar.xz mason-2db93f76da605bccada1be3b020f99b3a67ea791.tar.zst mason-2db93f76da605bccada1be3b020f99b3a67ea791.zip | |
fix(functional): spread function args in _.apply (#770)
Diffstat (limited to 'tests/mason-core/functional/function_spec.lua')
| -rw-r--r-- | tests/mason-core/functional/function_spec.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/mason-core/functional/function_spec.lua b/tests/mason-core/functional/function_spec.lua index 6b36b53b..9f5189fd 100644 --- a/tests/mason-core/functional/function_spec.lua +++ b/tests/mason-core/functional/function_spec.lua @@ -147,6 +147,14 @@ describe("functional: function", function() assert.spy(fn).was_called_with(42) end) + it("should apply function", function() + local max = spy.new(math.max) + local max_fn = _.apply(max) + assert.equals(42, max_fn { 1, 2, 3, 4, 5, 6, 7, 8, 9, 42, 10, 8, 4 }) + assert.spy(max).was_called(1) + assert.spy(max).was_called_with(1, 2, 3, 4, 5, 6, 7, 8, 9, 42, 10, 8, 4) + end) + it("should apply value to function", function() local agent = spy.new() _.apply_to("007", agent) |
