From f6dca79f3aa2b55927a5f1cee4a6bf25d5c9bd37 Mon Sep 17 00:00:00 2001 From: watiko Date: Sat, 20 Feb 2016 17:18:23 +0900 Subject: 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 --- src/nvim/testdir/Makefile | 3 ++- src/nvim/testdir/test_alot.vim | 4 ++++ src/nvim/testdir/test_sort.vim | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/nvim/testdir/test_alot.vim create mode 100644 src/nvim/testdir/test_sort.vim (limited to 'src/nvim/testdir') 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 -- cgit From 313810ccada3b5f3dad73d8c376652533636f46b Mon Sep 17 00:00:00 2001 From: watiko Date: Sat, 20 Feb 2016 17:45:51 +0900 Subject: vim-patch:7.4.1143 Problem: Can't sort on floating point numbers. Solution: Add the "f" flag to ":sort". (Alex Jakushev) Also add the "f" flag to sort(). https://github.com/vim/vim/commit/f7edf40448a09e04eec3bd05e043f7fea93b07c9 --- src/nvim/testdir/test_sort.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_sort.vim b/src/nvim/testdir/test_sort.vim index 30dd167cd6..32ad7f8ad5 100644 --- a/src/nvim/testdir/test_sort.vim +++ b/src/nvim/testdir/test_sort.vim @@ -17,3 +17,7 @@ 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 + +func Test_sort_float() + call assert_equal([0.28, 3, 13.5], sort([13.5, 0.28, 3], 'f')) +endfunc -- cgit From 29a1807de8986fa3b8416f3d73c26fda91bce403 Mon Sep 17 00:00:00 2001 From: watiko Date: Sat, 20 Feb 2016 19:48:31 +0900 Subject: tests: Migrate legacy test sort --- src/nvim/testdir/test_alot.vim | 1 - src/nvim/testdir/test_sort.vim | 23 ----------------------- 2 files changed, 24 deletions(-) delete mode 100644 src/nvim/testdir/test_sort.vim (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index ea2a19a08f..1d1da94bac 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -1,4 +1,3 @@ " 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 deleted file mode 100644 index 32ad7f8ad5..0000000000 --- a/src/nvim/testdir/test_sort.vim +++ /dev/null @@ -1,23 +0,0 @@ -" 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 - -func Test_sort_float() - call assert_equal([0.28, 3, 13.5], sort([13.5, 0.28, 3], 'f')) -endfunc -- cgit From 1addc45e78155a73f52a00762cb77abbd3f8d993 Mon Sep 17 00:00:00 2001 From: watiko Date: Sat, 20 Feb 2016 20:47:37 +0900 Subject: test: Remove migrated legacy test from Makefile --- src/nvim/testdir/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 9f54a5918c..b760811585 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -37,7 +37,6 @@ SCRIPTS := \ test_breakindent.out \ test_close_count.out \ test_marks.out \ - test_match_conceal.out \ NEW_TESTS := \ test_alot.res \ -- cgit