Mercurial > vim
comparison src/testdir/test_vim9_builtin.vim @ 25731:f35efe44dacd v8.2.3401
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Commit: https://github.com/vim/vim/commit/10c83dde554b57ab4db71b96a0a02a5b6d1798e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 4 14:49:56 2021 +0200
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Problem: Vim9: cannot use a negative count with finddir() and findfile().
Solution: Adjust the return type. (closes https://github.com/vim/vim/issues/8776)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 Sep 2021 15:00:02 +0200 |
parents | 17830c066d4b |
children | ea0820d05257 |
comparison
equal
deleted
inserted
replaced
25730:10adc0110045 | 25731:f35efe44dacd |
---|---|
1025 CheckDefExecFailure(['echo filewritable(123)'], 'E1013:') | 1025 CheckDefExecFailure(['echo filewritable(123)'], 'E1013:') |
1026 CheckDefExecFailure(['echo filewritable(true)'], 'E1013:') | 1026 CheckDefExecFailure(['echo filewritable(true)'], 'E1013:') |
1027 enddef | 1027 enddef |
1028 | 1028 |
1029 def Test_finddir() | 1029 def Test_finddir() |
1030 mkdir('Xtestdir') | |
1031 finddir('Xtestdir', '**', -1)->assert_equal(['Xtestdir']) | |
1032 var lines =<< trim END | |
1033 var l: list<string> = finddir('nothing', '*;', -1) | |
1034 END | |
1035 CheckDefAndScriptSuccess(lines) | |
1036 delete('Xtestdir', 'rf') | |
1037 | |
1030 CheckDefAndScriptFailure2(['finddir(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1') | 1038 CheckDefAndScriptFailure2(['finddir(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1') |
1031 CheckDefAndScriptFailure2(['finddir(v:null)'], 'E1013: Argument 1: type mismatch, expected string but got special', 'E1174: String required for argument 1') | 1039 CheckDefAndScriptFailure2(['finddir(v:null)'], 'E1013: Argument 1: type mismatch, expected string but got special', 'E1174: String required for argument 1') |
1032 CheckDefExecFailure(['echo finddir("")'], 'E1175:') | 1040 CheckDefExecFailure(['echo finddir("")'], 'E1175:') |
1033 CheckDefAndScriptFailure2(['finddir("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2') | 1041 CheckDefAndScriptFailure2(['finddir("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2') |
1034 CheckDefAndScriptFailure2(['finddir("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') | 1042 CheckDefAndScriptFailure2(['finddir("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') |
1035 enddef | 1043 enddef |
1036 | 1044 |
1037 def Test_findfile() | 1045 def Test_findfile() |
1046 findfile('runtest.vim', '**', -1)->assert_equal(['runtest.vim']) | |
1047 var lines =<< trim END | |
1048 var l: list<string> = findfile('nothing', '*;', -1) | |
1049 END | |
1050 CheckDefAndScriptSuccess(lines) | |
1051 | |
1038 CheckDefExecFailure(['findfile(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool') | 1052 CheckDefExecFailure(['findfile(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool') |
1039 CheckDefExecFailure(['findfile(v:null)'], 'E1013: Argument 1: type mismatch, expected string but got special') | 1053 CheckDefExecFailure(['findfile(v:null)'], 'E1013: Argument 1: type mismatch, expected string but got special') |
1040 CheckDefExecFailure(['findfile("")'], 'E1175:') | 1054 CheckDefExecFailure(['findfile("")'], 'E1175:') |
1041 CheckDefAndScriptFailure2(['findfile("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2') | 1055 CheckDefAndScriptFailure2(['findfile("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2') |
1042 CheckDefAndScriptFailure2(['findfile("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') | 1056 CheckDefAndScriptFailure2(['findfile("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') |