patch 7.4.951
Problem: Sorting number strings does not work as expected. (Luc Hermitte)
Solution: Add the 'N" argument to sort()
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 3f65f43..c7db949 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -69,7 +69,7 @@
test_writefile.out
NEW_TESTS = test_assert.res \
- test_undolevels.res
+ test_alot.res
SCRIPTS_GUI = test16.out
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
new file mode 100644
index 0000000..9763509
--- /dev/null
+++ b/src/testdir/test_alot.vim
@@ -0,0 +1,5 @@
+" 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_undolevels.vim
+source test_sort.vim
diff --git a/src/testdir/test_sort.vim b/src/testdir/test_sort.vim
new file mode 100644
index 0000000..30dd167
--- /dev/null
+++ b/src/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