diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-29 22:05:26 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-29 22:05:26 +0100 |
commit | 5131c144feb046c5e2b72e6c172159d80ce06b3c (patch) | |
tree | b5b94c99c6137bdcdfed153263285be2bcefe228 /src/testdir/test_sort.vim | |
parent | a6b8976bb724f8c85dd5699d115d795f7b730298 (diff) |
patch 7.4.1464v7.4.1464
Problem: When the argument of sort() is zero or empty it fails.
Solution: Make zero work as documented. (suggested by Yasuhiro Matsumoto)
Diffstat (limited to 'src/testdir/test_sort.vim')
-rw-r--r-- | src/testdir/test_sort.vim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/testdir/test_sort.vim b/src/testdir/test_sort.vim index 2b097ceb96..819514a971 100644 --- a/src/testdir/test_sort.vim +++ b/src/testdir/test_sort.vim @@ -35,3 +35,11 @@ func Test_sort_nested() " test ability to call sort() from a compare function call assert_equal([1, 3, 5], sort([3, 1, 5], 'Compare1')) endfunc + +func Test_sort_default() + " docs say omitted, empty or zero argument sorts on string representation. + call assert_equal(["2", 1, 3.3], sort([3.3, 1, "2"])) + call assert_equal(["2", 1, 3.3], sort([3.3, 1, "2"], '')) + call assert_equal(["2", 1, 3.3], sort([3.3, 1, "2"], 0)) + call assert_fails('call sort([3.3, 1, "2"], 3)', "E474") +endfunc |