diff options
Diffstat (limited to 'test/functional/legacy/function_sort_spec.lua')
-rw-r--r-- | test/functional/legacy/function_sort_spec.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/legacy/function_sort_spec.lua b/test/functional/legacy/function_sort_spec.lua index 3347dd9699..fb4a5b7713 100644 --- a/test/functional/legacy/function_sort_spec.lua +++ b/test/functional/legacy/function_sort_spec.lua @@ -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) |