changeset 20887:5dd8e741060b v8.2.0995

patch 8.2.0995: insufficient testing for the readdir() sort option Commit: https://github.com/vim/vim/commit/e17f8817a1713a1ef20257c777a483b7ab57a841 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 17 20:30:44 2020 +0200 patch 8.2.0995: insufficient testing for the readdir() sort option Problem: Insufficient testing for the readdir() sort option. Solution: Add a few more tests. (Christian Brabandt, closes https://github.com/vim/vim/issues/6278)
author Bram Moolenaar <Bram@vim.org>
date Wed, 17 Jun 2020 20:45:04 +0200
parents 0c12bded9fc5
children 3c8982150ffe
files src/testdir/test_functions.vim src/version.c
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2014,6 +2014,25 @@ func Test_readdir_sort()
   let files = readdir(dir, '1', #{sort: 'icase'})
   call assert_equal(default->sort('i'), files, 'sort by ignoring case')
 
+  " 4) collation
+  let collate = v:collate
+  lang collate C
+  let files = readdir(dir, 1, #{sort: 'collate'})
+  call assert_equal(default->sort(), files, 'sort by C collation')
+  exe "lang collate" collate
+
+  " 5) Errors
+  call assert_fails('call readdir(dir, 1, 1)', 'E715')
+  call assert_fails('call readdir(dir, 1, #{sorta: 1})')
+  call assert_fails('call readdirex(dir, 1, #{sorta: 1})')
+
+  " 6) ignore other values in dict
+  let files = readdir(dir, '1', #{sort: 'c'})
+  call assert_equal(default, files, 'sort using default2')
+
+  " Cleanup
+  exe "lang collate" collate
+
   eval dir->delete('rf')
 endfunc
 
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    995,
+/**/
     994,
 /**/
     993,