aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-02-23 05:54:41 -0500
committerJustin M. Keyes <justinkz@gmail.com>2019-02-23 11:54:41 +0100
commit9327ea3e5a9b004fc494fd5a3864ad43086cddc9 (patch)
tree0925f18f84f245821b5b22538c408409c4399cb0 /src/nvim/testdir
parent246408621c405a6c0f24e2e5cd66e8776eb04fe6 (diff)
downloadrneovim-9327ea3e5a9b004fc494fd5a3864ad43086cddc9.tar.gz
rneovim-9327ea3e5a9b004fc494fd5a3864ad43086cddc9.tar.bz2
rneovim-9327ea3e5a9b004fc494fd5a3864ad43086cddc9.zip
vim-patch:8.1.0959: sorting large numbers is not tested (#9641)
Problem: Sorting large numbers is not tested and does not work properly. Solution: Add test. Fix comparing lines with and without a number. (Dominique Pelle, closes vim/vim#4017) https://github.com/vim/vim/commit/a25e3d06956f1bc11c68fe60149acce2d8547092
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_sort.vim71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_sort.vim b/src/nvim/testdir/test_sort.vim
index 14d008a17f..7da82b0185 100644
--- a/src/nvim/testdir/test_sort.vim
+++ b/src/nvim/testdir/test_sort.vim
@@ -1222,6 +1222,77 @@ func Test_sort_cmd()
enew!
endfunc
+func Test_sort_large_num()
+ new
+ a
+-2147483648
+-2147483647
+
+-1
+0
+1
+-2147483646
+2147483646
+2147483647
+2147483647
+-2147483648
+abc
+
+.
+ " Numerical sort. Non-numeric lines are ordered before numerical lines.
+ " Ordering of non-numerical is stable.
+ sort n
+ call assert_equal(['',
+ \ 'abc',
+ \ '',
+ \ '-2147483648',
+ \ '-2147483648',
+ \ '-2147483647',
+ \ '-2147483646',
+ \ '-1',
+ \ '0',
+ \ '1',
+ \ '2147483646',
+ \ '2147483647',
+ \ '2147483647'], getline(1, '$'))
+ bwipe!
+
+ if has('num64')
+ new
+ a
+-9223372036854775808
+-9223372036854775807
+
+-1
+0
+1
+-9223372036854775806
+9223372036854775806
+9223372036854775807
+9223372036854775807
+-9223372036854775808
+abc
+
+.
+ sort n
+ call assert_equal(['',
+ \ 'abc',
+ \ '',
+ \ '-9223372036854775808',
+ \ '-9223372036854775808',
+ \ '-9223372036854775807',
+ \ '-9223372036854775806',
+ \ '-1',
+ \ '0',
+ \ '1',
+ \ '9223372036854775806',
+ \ '9223372036854775807',
+ \ '9223372036854775807'], getline(1, '$'))
+ bwipe!
+ endif
+endfunc
+
+
func Test_sort_cmd_report()
enew!
call append(0, repeat([1], 3) + repeat([2], 3) + repeat([3], 3))