diff options
| author | watiko <service@mail.watiko.net> | 2016-02-20 17:18:23 +0900 |
|---|---|---|
| committer | watiko <service@mail.watiko.net> | 2016-03-02 17:32:24 +0900 |
| commit | f6dca79f3aa2b55927a5f1cee4a6bf25d5c9bd37 (patch) | |
| tree | 52c95d1a5b11bdd16b73e13a22a9d179cccac34a /src/nvim/testdir | |
| parent | 576c5f7b74bfa46ba4c7290b5e5b951d3ee2d0bc (diff) | |
| download | rneovim-f6dca79f3aa2b55927a5f1cee4a6bf25d5c9bd37.tar.gz rneovim-f6dca79f3aa2b55927a5f1cee4a6bf25d5c9bd37.tar.bz2 rneovim-f6dca79f3aa2b55927a5f1cee4a6bf25d5c9bd37.zip | |
vim-patch:7.4.951
Problem: Sorting number strings does not work as expected. (Luc Hermitte)
Solution: Add the 'N" argument to sort()
https://github.com/vim/vim/commit/b00da1d6d1655cb6e415f84ecc3be5ff3b790811
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/Makefile | 3 | ||||
| -rw-r--r-- | src/nvim/testdir/test_alot.vim | 4 | ||||
| -rw-r--r-- | src/nvim/testdir/test_sort.vim | 19 |
3 files changed, 25 insertions, 1 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 63ca4cf6c4..9f54a5918c 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -39,7 +39,8 @@ SCRIPTS := \ test_marks.out \ test_match_conceal.out \ -NEW_TESTS = +NEW_TESTS := \ + test_alot.res \ SCRIPTS_GUI := test16.out diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim new file mode 100644 index 0000000000..ea2a19a08f --- /dev/null +++ b/src/nvim/testdir/test_alot.vim @@ -0,0 +1,4 @@ +" A series of tests that can run in one Vim invocation. +" This makes testing go faster, since Vim doesn't need to restart. + +source test_sort.vim diff --git a/src/nvim/testdir/test_sort.vim b/src/nvim/testdir/test_sort.vim new file mode 100644 index 0000000000..30dd167cd6 --- /dev/null +++ b/src/nvim/testdir/test_sort.vim @@ -0,0 +1,19 @@ +" Test sort() + +func Test_sort_strings() + " numbers compared as strings + call assert_equal([1, 2, 3], sort([3, 2, 1])) + call assert_equal([13, 28, 3], sort([3, 28, 13])) +endfunc + +func Test_sort_numeric() + call assert_equal([1, 2, 3], sort([3, 2, 1], 'n')) + call assert_equal([3, 13, 28], sort([13, 28, 3], 'n')) + " strings are not sorted + call assert_equal(['13', '28', '3'], sort(['13', '28', '3'], 'n')) +endfunc + +func Test_sort_numbers() + call assert_equal([3, 13, 28], sort([13, 28, 3], 'N')) + call assert_equal(['3', '13', '28'], sort(['13', '28', '3'], 'N')) +endfunc |