From 2db93f76da605bccada1be3b020f99b3a67ea791 Mon Sep 17 00:00:00 2001 From: William Boman Date: Mon, 19 Dec 2022 11:21:24 +0100 Subject: fix(functional): spread function args in _.apply (#770) --- tests/mason-core/functional/function_spec.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') 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) -- cgit v1.2.3-70-g09d2