mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.1464
Problem: When the argument of sort() is zero or empty it fails.
Solution: Make zero work as documented. (suggested by Yasuhiro Matsumoto)
5131c144fe
This commit is contained in:
@@ -3,6 +3,8 @@ local clear = helpers.clear
|
||||
local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
local execute = helpers.execute
|
||||
local exc_exec = helpers.exc_exec
|
||||
local neq = helpers.neq
|
||||
|
||||
describe('sort', function()
|
||||
before_each(clear)
|
||||
@@ -39,4 +41,12 @@ describe('sort', function()
|
||||
execute('endfunc')
|
||||
eq({1, 3, 5}, eval("sort([3, 1, 5], 'Compare1')"))
|
||||
end)
|
||||
|
||||
it('default sort', function()
|
||||
-- docs say omitted, empty or zero argument sorts on string representation
|
||||
eq({'2', 1, 3.3}, eval('sort([3.3, 1, "2"])'))
|
||||
eq({'2', 1, 3.3}, eval([[sort([3.3, 1, "2"], '')]]))
|
||||
eq({'2', 1, 3.3}, eval('sort([3.3, 1, "2"], 0)'))
|
||||
neq(exc_exec('call sort([3.3, 1, "2"], 3)'):find('E474:'), nil)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user