forked from nvim-lua/plenary.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: couple bugs with multiple results and varargs (...) (nvim-lua#515)
* fix(vararg.rotate): edge cases and nil arguments - zero argument rotation returned one value (a global by the name A0) - the generic fallback dropped the first argument and trailing nils * fix: functional.partial & fun.bind These only worked for binding exactly one parameter. * Include generated rotate.lua file in linting
- Loading branch information
Showing
7 changed files
with
56 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
local f = require "plenary.functional" | ||
|
||
describe("functional", function() | ||
describe("partial", function() | ||
local function args(...) | ||
assert.is.equal(4, select("#", ...)) | ||
return table.concat({ ... }, ",") | ||
end | ||
it("should bind correct parameters", function() | ||
local expected = args(1, 2, 3, 4) | ||
assert.is.equal(expected, f.partial(args)(1, 2, 3, 4)) | ||
assert.is.equal(expected, f.partial(args, 1)(2, 3, 4)) | ||
assert.is.equal(expected, f.partial(args, 1, 2)(3, 4)) | ||
assert.is.equal(expected, f.partial(args, 1, 2, 3)(4)) | ||
assert.is.equal(expected, f.partial(args, 1, 2, 3, 4)()) | ||
end) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters