Mercurial > vim
annotate src/testdir/test_vim9_builtin.vim @ 28419:6e501ecd1bb7 v8.2.4734
patch 8.2.4734: getcharpos() may change a mark position
Commit: https://github.com/vim/vim/commit/3caf1cce2b85a8f24195d057f0ad63082543e99e
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 11 13:05:16 2022 +0100
patch 8.2.4734: getcharpos() may change a mark position
Problem: getcharpos() may change a mark position.
Solution: Copy the mark position. (closes https://github.com/vim/vim/issues/10148)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 11 Apr 2022 14:15:04 +0200 |
parents | fabe722b24e9 |
children | da28696e5340 |
rev | line source |
---|---|
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Test using builtin functions in the Vim9 script language. |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 source check.vim |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4 import './vim9.vim' as v9 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 " Test for passing too many or too few arguments to builtin functions |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 func Test_internalfunc_arg_error() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 let l =<< trim END |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 def! FArgErr(): float |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 return ceil(1.1, 2) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 defcompile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 END |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 call writefile(l, 'Xinvalidarg') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 call assert_fails('so Xinvalidarg', 'E118:', '', 1, 'FArgErr') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 let l =<< trim END |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 def! FArgErr(): float |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 return ceil() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 defcompile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 END |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 call writefile(l, 'Xinvalidarg') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 call assert_fails('so Xinvalidarg', 'E119:', '', 1, 'FArgErr') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 call delete('Xinvalidarg') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 endfunc |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 " Test for builtin functions returning different types |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 func Test_InternalFuncRetType() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 let lines =<< trim END |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 def RetFloat(): float |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 return ceil(1.456) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 def RetListAny(): list<any> |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
35 return items({k: 'v'}) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 def RetListString(): list<string> |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 return split('a:b:c', ':') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 def RetListDictAny(): list<dict<any>> |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 return getbufinfo() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 def RetDictNumber(): dict<number> |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 return wordcount() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 def RetDictString(): dict<string> |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 return environ() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 END |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 call writefile(lines, 'Xscript') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 source Xscript |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 call RetFloat()->assert_equal(2.0) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 call RetListAny()->assert_equal([['k', 'v']]) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 call RetListString()->assert_equal(['a', 'b', 'c']) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 call RetListDictAny()->assert_notequal([]) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 call RetDictNumber()->assert_notequal({}) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 call RetDictString()->assert_notequal({}) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 call delete('Xscript') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 endfunc |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 def Test_abs() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 assert_equal(0, abs(0)) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 assert_equal(2, abs(-2)) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 assert_equal(3, abs(3)) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
70 v9.CheckDefAndScriptFailure(['abs("text")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 if has('float') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 assert_equal(0, abs(0)) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 assert_equal(2.0, abs(-2.0)) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 assert_equal(3.0, abs(3.0)) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 endif |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
78 def Test_add() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
79 v9.CheckDefAndScriptFailure(['add({}, 1)'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<unknown>', 'E1226: List or Blob required for argument 1']) |
27503
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
80 v9.CheckDefExecFailure([ |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
81 'var ln: list<number> = [1]', |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
82 'add(ln, "a")'], |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
83 'E1012: Type mismatch; expected number but got string') |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
84 assert_equal([1, 'a'], add([1], 'a')) |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
85 assert_equal(0z1234, add(0z12, 0x34)) |
26891
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
86 |
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
87 var lines =<< trim END |
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
88 vim9script |
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
89 g:thelist = [1] |
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
90 lockvar g:thelist |
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
91 def TryChange() |
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
92 g:thelist->add(2) |
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
93 enddef |
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
94 TryChange() |
902b8bee5254
patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list
Bram Moolenaar <Bram@vim.org>
parents:
26782
diff
changeset
|
95 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
96 v9.CheckScriptFailure(lines, 'E741:') |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
97 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
98 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
99 def Test_add_blob() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
100 var b1: blob = 0z12 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
101 add(b1, 0x34) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
102 assert_equal(0z1234, b1) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
103 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
104 var b2: blob # defaults to empty blob |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
105 add(b2, 0x67) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
106 assert_equal(0z67, b2) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
107 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
108 var lines =<< trim END |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
109 var b: blob |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
110 add(b, "x") |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
111 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
112 v9.CheckDefFailure(lines, 'E1012:', 2) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
113 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
114 lines =<< trim END |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
115 add(test_null_blob(), 123) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
116 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
117 v9.CheckDefExecAndScriptFailure(lines, 'E1131:', 1) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
118 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
119 lines =<< trim END |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
120 var b: blob = test_null_blob() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
121 add(b, 123) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
122 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
123 v9.CheckDefExecFailure(lines, 'E1131:', 2) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
124 |
28217
662d2d5db9a6
patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
125 # Getting variable with NULL blob fails |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
126 lines =<< trim END |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
127 vim9script |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
128 var b: blob = test_null_blob() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
129 add(b, 123) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
130 END |
28217
662d2d5db9a6
patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
131 v9.CheckScriptFailure(lines, 'E1131:', 3) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
132 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
133 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 def Test_add_list() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 var l: list<number> # defaults to empty list |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 add(l, 9) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 assert_equal([9], l) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 var lines =<< trim END |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 var l: list<number> |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 add(l, "x") |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
143 v9.CheckDefFailure(lines, 'E1012:', 2) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 lines =<< trim END |
24482
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
146 add(test_null_list(), 123) |
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
147 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
148 v9.CheckDefExecAndScriptFailure(lines, 'E1130:', 1) |
24482
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
149 |
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
150 lines =<< trim END |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 var l: list<number> = test_null_list() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 add(l, 123) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
154 v9.CheckDefExecFailure(lines, 'E1130:', 2) |
24482
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
155 |
28345
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
156 # Getting an uninitialized variable allocates a new list at script level |
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
157 lines =<< trim END |
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
158 vim9script |
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
159 var l: list<number> |
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
160 add(l, 123) |
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
161 END |
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
162 v9.CheckScriptSuccess(lines) |
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
163 |
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
164 # Adding to a variable set to a NULL list fails |
24482
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
165 lines =<< trim END |
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
166 vim9script |
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
167 var l: list<number> = test_null_list() |
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
168 add(l, 123) |
3d5a66e478f8
patch 8.2.2781: add() silently skips when adding to null list or blob
Bram Moolenaar <Bram@vim.org>
parents:
24414
diff
changeset
|
169 END |
28345
fabe722b24e9
patch 8.2.4698: Vim9: script variable has no flag that it was set
Bram Moolenaar <Bram@vim.org>
parents:
28307
diff
changeset
|
170 v9.CheckScriptFailure(lines, 'E1130:', 3) |
25182
14448e7acdb2
patch 8.2.3127: Vim9: no error when adding number to list of string
Bram Moolenaar <Bram@vim.org>
parents:
25143
diff
changeset
|
171 |
14448e7acdb2
patch 8.2.3127: Vim9: no error when adding number to list of string
Bram Moolenaar <Bram@vim.org>
parents:
25143
diff
changeset
|
172 lines =<< trim END |
14448e7acdb2
patch 8.2.3127: Vim9: no error when adding number to list of string
Bram Moolenaar <Bram@vim.org>
parents:
25143
diff
changeset
|
173 vim9script |
14448e7acdb2
patch 8.2.3127: Vim9: no error when adding number to list of string
Bram Moolenaar <Bram@vim.org>
parents:
25143
diff
changeset
|
174 var l: list<string> = ['a'] |
14448e7acdb2
patch 8.2.3127: Vim9: no error when adding number to list of string
Bram Moolenaar <Bram@vim.org>
parents:
25143
diff
changeset
|
175 l->add(123) |
14448e7acdb2
patch 8.2.3127: Vim9: no error when adding number to list of string
Bram Moolenaar <Bram@vim.org>
parents:
25143
diff
changeset
|
176 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
177 v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected string but got number', 3) |
25184
e495f40e4b07
patch 8.2.3128: Vim9: uninitialzed list does not get type checked
Bram Moolenaar <Bram@vim.org>
parents:
25182
diff
changeset
|
178 |
e495f40e4b07
patch 8.2.3128: Vim9: uninitialzed list does not get type checked
Bram Moolenaar <Bram@vim.org>
parents:
25182
diff
changeset
|
179 lines =<< trim END |
e495f40e4b07
patch 8.2.3128: Vim9: uninitialzed list does not get type checked
Bram Moolenaar <Bram@vim.org>
parents:
25182
diff
changeset
|
180 vim9script |
e495f40e4b07
patch 8.2.3128: Vim9: uninitialzed list does not get type checked
Bram Moolenaar <Bram@vim.org>
parents:
25182
diff
changeset
|
181 var l: list<string> |
e495f40e4b07
patch 8.2.3128: Vim9: uninitialzed list does not get type checked
Bram Moolenaar <Bram@vim.org>
parents:
25182
diff
changeset
|
182 l->add(123) |
e495f40e4b07
patch 8.2.3128: Vim9: uninitialzed list does not get type checked
Bram Moolenaar <Bram@vim.org>
parents:
25182
diff
changeset
|
183 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
184 v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected string but got number', 3) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
187 def Test_and() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
188 v9.CheckDefAndScriptFailure(['and("x", 0x2)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
189 v9.CheckDefAndScriptFailure(['and(0x1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
190 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
191 |
23654
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
192 def Test_append() |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
193 new |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
194 setline(1, range(3)) |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
195 var res1: number = append(1, 'one') |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
196 assert_equal(0, res1) |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
197 var res2: bool = append(3, 'two') |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
198 assert_equal(false, res2) |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
199 assert_equal(['0', 'one', '1', 'two', '2'], getline(1, 6)) |
24258
8b4159943d9a
patch 8.2.2670: Vim9: error for append(0, text)
Bram Moolenaar <Bram@vim.org>
parents:
24254
diff
changeset
|
200 |
8b4159943d9a
patch 8.2.2670: Vim9: error for append(0, text)
Bram Moolenaar <Bram@vim.org>
parents:
24254
diff
changeset
|
201 append(0, 'zero') |
8b4159943d9a
patch 8.2.2670: Vim9: error for append(0, text)
Bram Moolenaar <Bram@vim.org>
parents:
24254
diff
changeset
|
202 assert_equal('zero', getline(1)) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
203 append(0, {a: 10}) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
204 assert_equal("{'a': 10}", getline(1)) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
205 append(0, function('min')) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
206 assert_equal("function('min')", getline(1)) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
207 v9.CheckDefAndScriptFailure(['append([1], "x")'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
208 v9.CheckDefExecAndScriptFailure(['append("", "x")'], 'E1209: Invalid value for a line number') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
209 v9.CheckDefExecAndScriptFailure(['append(".a", "x")'], 'E1209: Invalid value for a line number') |
26782
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
210 # only get one error |
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
211 assert_fails('append("''aa", "x")', ['E1209: Invalid value for a line number: "''aa"', 'E1209:']) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
212 v9.CheckDefExecAndScriptFailure(['append(-1, "x")'], 'E966: Invalid line number: -1') |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
213 bwipe! |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
214 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
215 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
216 def Test_appendbufline() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
217 new |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
218 var bnum: number = bufnr() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
219 :wincmd w |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
220 appendbufline(bnum, 0, range(3)) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
221 var res1: number = appendbufline(bnum, 1, 'one') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
222 assert_equal(0, res1) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
223 var res2: bool = appendbufline(bnum, 3, 'two') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
224 assert_equal(false, res2) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
225 assert_equal(['0', 'one', '1', 'two', '2', ''], getbufline(bnum, 1, '$')) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
226 appendbufline(bnum, 0, 'zero') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
227 assert_equal(['zero'], getbufline(bnum, 1)) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
228 v9.CheckDefAndScriptFailure(['appendbufline([1], 1, "x")'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
229 v9.CheckDefAndScriptFailure(['appendbufline(1, [1], "x")'], ['E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
230 v9.CheckDefExecAndScriptFailure(['appendbufline(' .. bnum .. ', -1, "x")'], 'E966: Invalid line number: -1') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
231 v9.CheckDefExecAndScriptFailure(['appendbufline(' .. bnum .. ', "$a", "x")'], 'E1030: Using a String as a Number: "$a"') |
26782
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
232 assert_fails('appendbufline(' .. bnum .. ', "$a", "x")', ['E1030: Using a String as a Number: "$a"', 'E1030:']) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
233 v9.CheckDefAndScriptFailure(['appendbufline(1, 1, {"a": 10})'], ['E1013: Argument 3: type mismatch, expected string but got dict<number>', 'E1224: String, Number or List required for argument 3']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
234 bnum->bufwinid()->win_gotoid() |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
235 appendbufline('', 0, 'numbers') |
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
236 getline(1)->assert_equal('numbers') |
24258
8b4159943d9a
patch 8.2.2670: Vim9: error for append(0, text)
Bram Moolenaar <Bram@vim.org>
parents:
24254
diff
changeset
|
237 bwipe! |
23654
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
238 enddef |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
239 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
240 def Test_argc() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
241 v9.CheckDefAndScriptFailure(['argc("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
242 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
243 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
244 def Test_arglistid() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
245 v9.CheckDefAndScriptFailure(['arglistid("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
246 v9.CheckDefAndScriptFailure(['arglistid(1, "y")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
247 v9.CheckDefAndScriptFailure(['arglistid("x", "y")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
248 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
249 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
250 def Test_argv() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
251 v9.CheckDefAndScriptFailure(['argv("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
252 v9.CheckDefAndScriptFailure(['argv(1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
253 v9.CheckDefAndScriptFailure(['argv("x", "y")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
254 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
255 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
256 def Test_assert_beeps() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
257 v9.CheckDefAndScriptFailure(['assert_beeps(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
258 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
259 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
260 def Test_assert_equalfile() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
261 v9.CheckDefAndScriptFailure(['assert_equalfile(1, "f2")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
262 v9.CheckDefAndScriptFailure(['assert_equalfile("f1", true)'], ['E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
263 v9.CheckDefAndScriptFailure(['assert_equalfile("f1", "f2", ["a"])'], ['E1013: Argument 3: type mismatch, expected string but got list<string>', 'E1174: String required for argument 3']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
264 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
265 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
266 def Test_assert_exception() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
267 v9.CheckDefAndScriptFailure(['assert_exception({})'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
268 v9.CheckDefAndScriptFailure(['assert_exception("E1:", v:null)'], ['E1013: Argument 2: type mismatch, expected string but got special', 'E1174: String required for argument 2']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
269 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
270 |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
271 def Test_assert_fails() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
272 v9.CheckDefAndScriptFailure(['assert_fails([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
273 v9.CheckDefAndScriptFailure(['assert_fails("a", true)'], ['E1013: Argument 2: type mismatch, expected string but got bool', 'E1222: String or List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
274 v9.CheckDefAndScriptFailure(['assert_fails("a", "b", "c", "d")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
275 v9.CheckDefAndScriptFailure(['assert_fails("a", "b", "c", 4, 5)'], ['E1013: Argument 5: type mismatch, expected string but got number', 'E1174: String required for argument 5']) |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
276 enddef |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
277 |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
278 def Test_assert_inrange() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
279 v9.CheckDefAndScriptFailure(['assert_inrange("a", 2, 3)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
280 v9.CheckDefAndScriptFailure(['assert_inrange(1, "b", 3)'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
281 v9.CheckDefAndScriptFailure(['assert_inrange(1, 2, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
282 v9.CheckDefAndScriptFailure(['assert_inrange(1, 2, 3, 4)'], ['E1013: Argument 4: type mismatch, expected string but got number', 'E1174: String required for argument 4']) |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
283 enddef |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
284 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
285 def Test_assert_match() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
286 v9.CheckDefAndScriptFailure(['assert_match({}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', '']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
287 v9.CheckDefAndScriptFailure(['assert_match("a", 1)'], ['E1013: Argument 2: type mismatch, expected string but got number', '']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
288 v9.CheckDefAndScriptFailure(['assert_match("a", "b", null)'], ['E1013: Argument 3: type mismatch, expected string but got special', '']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
289 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
290 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
291 def Test_assert_nobeep() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
292 v9.CheckDefAndScriptFailure(['assert_nobeep(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
293 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
294 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
295 def Test_assert_notmatch() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
296 v9.CheckDefAndScriptFailure(['assert_notmatch({}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', '']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
297 v9.CheckDefAndScriptFailure(['assert_notmatch("a", 1)'], ['E1013: Argument 2: type mismatch, expected string but got number', '']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
298 v9.CheckDefAndScriptFailure(['assert_notmatch("a", "b", null)'], ['E1013: Argument 3: type mismatch, expected string but got special', '']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
299 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
300 |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
301 def Test_assert_report() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
302 v9.CheckDefAndScriptFailure(['assert_report([1, 2])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1']) |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
303 enddef |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
304 |
24246
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
305 def Test_balloon_show() |
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
306 CheckGui |
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
307 CheckFeature balloon_eval |
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
308 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
309 assert_fails('balloon_show(10)', 'E1222:') |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
310 assert_fails('balloon_show(true)', 'E1222:') |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
311 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
312 v9.CheckDefAndScriptFailure(['balloon_show(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
313 v9.CheckDefAndScriptFailure(['balloon_show({"a": 10})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1']) |
24246
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
314 enddef |
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
315 |
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
316 def Test_balloon_split() |
24248
883d7ceffd97
patch 8.2.2665: test failures
Bram Moolenaar <Bram@vim.org>
parents:
24246
diff
changeset
|
317 CheckFeature balloon_eval_term |
24246
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
318 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
319 assert_fails('balloon_split([])', 'E1174:') |
24246
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
320 assert_fails('balloon_split(true)', 'E1174:') |
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
321 enddef |
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
322 |
25806
8d55e978f95b
patch 8.2.3438: cannot manipulate blobs
Bram Moolenaar <Bram@vim.org>
parents:
25784
diff
changeset
|
323 def Test_blob2list() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
324 assert_equal(['x', 'x'], blob2list(0z1234)->map((_, _) => 'x')) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
325 v9.CheckDefAndScriptFailure(['blob2list(10)'], ['E1013: Argument 1: type mismatch, expected blob but got number', 'E1238: Blob required for argument 1']) |
25806
8d55e978f95b
patch 8.2.3438: cannot manipulate blobs
Bram Moolenaar <Bram@vim.org>
parents:
25784
diff
changeset
|
326 enddef |
8d55e978f95b
patch 8.2.3438: cannot manipulate blobs
Bram Moolenaar <Bram@vim.org>
parents:
25784
diff
changeset
|
327 |
24210
083f07f99e20
patch 8.2.2646: Vim9: error for not using string doesn't mentionargument
Bram Moolenaar <Bram@vim.org>
parents:
24118
diff
changeset
|
328 def Test_browse() |
083f07f99e20
patch 8.2.2646: Vim9: error for not using string doesn't mentionargument
Bram Moolenaar <Bram@vim.org>
parents:
24118
diff
changeset
|
329 CheckFeature browse |
083f07f99e20
patch 8.2.2646: Vim9: error for not using string doesn't mentionargument
Bram Moolenaar <Bram@vim.org>
parents:
24118
diff
changeset
|
330 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
331 v9.CheckDefAndScriptFailure(['browse(2, "title", "dir", "file")'], ['E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
332 v9.CheckDefAndScriptFailure(['browse(true, 2, "dir", "file")'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
333 v9.CheckDefAndScriptFailure(['browse(true, "title", 3, "file")'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
334 v9.CheckDefAndScriptFailure(['browse(true, "title", "dir", 4)'], ['E1013: Argument 4: type mismatch, expected string but got number', 'E1174: String required for argument 4']) |
24210
083f07f99e20
patch 8.2.2646: Vim9: error for not using string doesn't mentionargument
Bram Moolenaar <Bram@vim.org>
parents:
24118
diff
changeset
|
335 enddef |
083f07f99e20
patch 8.2.2646: Vim9: error for not using string doesn't mentionargument
Bram Moolenaar <Bram@vim.org>
parents:
24118
diff
changeset
|
336 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
337 def Test_browsedir() |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
338 if has('browse') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
339 v9.CheckDefAndScriptFailure(['browsedir({}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
340 v9.CheckDefAndScriptFailure(['browsedir("a", [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2']) |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
341 endif |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
342 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
343 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
344 def Test_bufadd() |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
345 assert_fails('bufadd([])', 'E1174:') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
346 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
347 |
24246
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
348 def Test_bufexists() |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
349 assert_fails('bufexists(true)', 'E1220:') |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
350 bufexists('')->assert_false() |
24246
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
351 enddef |
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
352 |
23654
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
353 def Test_buflisted() |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
354 var res: bool = buflisted('asdf') |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
355 assert_equal(false, res) |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
356 assert_fails('buflisted(true)', 'E1220:') |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
357 assert_fails('buflisted([])', 'E1220:') |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
358 buflisted('')->assert_false() |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
359 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
360 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
361 def Test_bufload() |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
362 assert_fails('bufload([])', 'E1220:') |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
363 bufload('')->assert_equal(0) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
364 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
365 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
366 def Test_bufloaded() |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
367 assert_fails('bufloaded(true)', 'E1220:') |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
368 assert_fails('bufloaded([])', 'E1220:') |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
369 bufloaded('')->assert_false() |
23654
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
370 enddef |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
371 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 def Test_bufname() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 split SomeFile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 bufname('%')->assert_equal('SomeFile') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 edit OtherFile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 bufname('#')->assert_equal('SomeFile') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 close |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
378 assert_fails('bufname(true)', 'E1220:') |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
379 assert_fails('bufname([])', 'E1220:') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 |
28233
e31f1a949d4e
patch 8.2.4643: Vim9: variable may be locked unintentionally
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
382 let s:bufnr_res = 0 |
e31f1a949d4e
patch 8.2.4643: Vim9: variable may be locked unintentionally
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
383 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 def Test_bufnr() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 var buf = bufnr() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 bufnr('%')->assert_equal(buf) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 |
28233
e31f1a949d4e
patch 8.2.4643: Vim9: variable may be locked unintentionally
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
388 # check the lock is not taken over through the stack |
e31f1a949d4e
patch 8.2.4643: Vim9: variable may be locked unintentionally
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
389 const nr = 10 |
e31f1a949d4e
patch 8.2.4643: Vim9: variable may be locked unintentionally
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
390 bufnr_res = bufnr() |
e31f1a949d4e
patch 8.2.4643: Vim9: variable may be locked unintentionally
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
391 bufnr_res = 12345 |
e31f1a949d4e
patch 8.2.4643: Vim9: variable may be locked unintentionally
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
392 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
393 buf = bufnr('Xdummy', true) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 buf->assert_notequal(-1) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 exe 'bwipe! ' .. buf |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
396 v9.CheckDefAndScriptFailure(['bufnr([1])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
397 v9.CheckDefAndScriptFailure(['bufnr(1, 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 def Test_bufwinid() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 var origwin = win_getid() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 below split SomeFile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 var SomeFileID = win_getid() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 below split OtherFile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 below split SomeFile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 bufwinid('SomeFile')->assert_equal(SomeFileID) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 win_gotoid(origwin) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 only |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 bwipe SomeFile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 bwipe OtherFile |
24246
35603c7991d7
patch 8.2.2664: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24222
diff
changeset
|
412 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
413 assert_fails('bufwinid(true)', 'E1220:') |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
414 assert_fails('bufwinid([])', 'E1220:') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
415 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
416 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
417 def Test_bufwinnr() |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
418 assert_fails('bufwinnr(true)', 'E1220:') |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
419 assert_fails('bufwinnr([])', 'E1220:') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
420 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
421 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
422 def Test_byte2line() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
423 v9.CheckDefAndScriptFailure(['byte2line("1")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
424 v9.CheckDefAndScriptFailure(['byte2line([])'], ['E1013: Argument 1: type mismatch, expected number but got list<unknown>', 'E1210: Number required for argument 1']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
425 byte2line(0)->assert_equal(-1) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
428 def Test_byteidx() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
429 v9.CheckDefAndScriptFailure(['byteidx(1, 2)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
430 v9.CheckDefAndScriptFailure(['byteidx("a", "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
431 byteidx('', 0)->assert_equal(0) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
432 byteidx('', 1)->assert_equal(-1) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
433 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
434 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
435 def Test_byteidxcomp() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
436 v9.CheckDefAndScriptFailure(['byteidxcomp(1, 2)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
437 v9.CheckDefAndScriptFailure(['byteidxcomp("a", "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
438 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
439 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 def Test_call_call() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 var l = [3, 2, 1] |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 call('reverse', [l]) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 l->assert_equal([1, 2, 3]) |
26731
7f4cc4e58f75
patch 8.2.3894: Vim9: no proper type check for first argument of call()
Bram Moolenaar <Bram@vim.org>
parents:
26686
diff
changeset
|
444 |
27841
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
445 var lines =<< trim END |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
446 vim9script |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
447 def Outer() |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
448 def g:Inner() |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
449 g:done = 'Inner' |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
450 enddef |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
451 call(g:Inner, []) |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
452 enddef |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
453 Outer() |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
454 assert_equal('Inner', g:done) |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
455 unlet g:done |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
456 END |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
457 v9.CheckScriptSuccess(lines) |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
458 delfunc g:Inner |
5ce69c07a106
patch 8.2.4446: Vim9: cannot refer to a global function like a local one
Bram Moolenaar <Bram@vim.org>
parents:
27831
diff
changeset
|
459 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
460 v9.CheckDefExecAndScriptFailure(['call(123, [2])'], 'E1256: String or function required for argument 1') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
461 v9.CheckDefExecAndScriptFailure(['call(true, [2])'], 'E1256: String or function required for argument 1') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
462 v9.CheckDefAndScriptFailure(['call("reverse", 2)'], ['E1013: Argument 2: type mismatch, expected list<any> but got number', 'E1211: List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
463 v9.CheckDefAndScriptFailure(['call("reverse", [2], [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
466 def Test_ch_canread() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
467 if !has('channel') |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
468 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
469 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
470 v9.CheckDefAndScriptFailure(['ch_canread(10)'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
471 endif |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
472 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
473 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
474 def Test_ch_close() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
475 if !has('channel') |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
476 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
477 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
478 v9.CheckDefAndScriptFailure(['ch_close("c")'], ['E1013: Argument 1: type mismatch, expected channel but got string', 'E1217: Channel or Job required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
479 endif |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
480 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
481 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
482 def Test_ch_close_in() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
483 if !has('channel') |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
484 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
485 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
486 v9.CheckDefAndScriptFailure(['ch_close_in(true)'], ['E1013: Argument 1: type mismatch, expected channel but got bool', 'E1217: Channel or Job required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
487 endif |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
488 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
489 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
490 def Test_ch_evalexpr() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
491 if !has('channel') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
492 CheckFeature channel |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
493 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
494 v9.CheckDefAndScriptFailure(['ch_evalexpr(1, "a")'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
495 v9.CheckDefAndScriptFailure(['ch_evalexpr(test_null_channel(), 1, [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
496 endif |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
497 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
498 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
499 def Test_ch_evalraw() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
500 if !has('channel') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
501 CheckFeature channel |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
502 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
503 v9.CheckDefAndScriptFailure(['ch_evalraw(1, "")'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
504 v9.CheckDefAndScriptFailure(['ch_evalraw(test_null_channel(), 1)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1221: String or Blob required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
505 v9.CheckDefAndScriptFailure(['ch_evalraw(test_null_channel(), "", [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
506 endif |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
507 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
508 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
509 def Test_ch_getbufnr() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
510 if !has('channel') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
511 CheckFeature channel |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
512 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
513 v9.CheckDefAndScriptFailure(['ch_getbufnr(1, "a")'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
514 v9.CheckDefAndScriptFailure(['ch_getbufnr(test_null_channel(), 1)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
515 # test empty string argument for ch_getbufnr() |
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
516 var job: job = job_start(&shell) |
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
517 job->ch_getbufnr('')->assert_equal(-1) |
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
518 job_stop(job) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
519 endif |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
520 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
521 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
522 def Test_ch_getjob() |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
523 if !has('channel') |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
524 CheckFeature channel |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
525 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
526 v9.CheckDefAndScriptFailure(['ch_getjob(1)'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
527 v9.CheckDefAndScriptFailure(['ch_getjob({"a": 10})'], ['E1013: Argument 1: type mismatch, expected channel but got dict<number>', 'E1217: Channel or Job required for argument 1']) |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
528 assert_equal(0, ch_getjob(test_null_channel())) |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
529 endif |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
530 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
531 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
532 def Test_ch_info() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
533 if !has('channel') |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
534 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
535 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
536 v9.CheckDefAndScriptFailure(['ch_info([1])'], ['E1013: Argument 1: type mismatch, expected channel but got list<number>', 'E1217: Channel or Job required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
537 endif |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
538 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
539 |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
540 def Test_ch_log() |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
541 if !has('channel') |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
542 CheckFeature channel |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
543 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
544 v9.CheckDefAndScriptFailure(['ch_log(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
545 v9.CheckDefAndScriptFailure(['ch_log("a", 1)'], ['E1013: Argument 2: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 2']) |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
546 endif |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
547 enddef |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
548 |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
549 def Test_ch_logfile() |
24349
21c72f782ae1
patch 8.2.2715: Vim9: tests fail without the channel feature
Bram Moolenaar <Bram@vim.org>
parents:
24258
diff
changeset
|
550 if !has('channel') |
21c72f782ae1
patch 8.2.2715: Vim9: tests fail without the channel feature
Bram Moolenaar <Bram@vim.org>
parents:
24258
diff
changeset
|
551 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
552 else |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
553 assert_fails('ch_logfile(true)', 'E1174:') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
554 assert_fails('ch_logfile("foo", true)', 'E1174:') |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
555 ch_logfile('', '')->assert_equal(0) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
556 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
557 v9.CheckDefAndScriptFailure(['ch_logfile(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
558 v9.CheckDefAndScriptFailure(['ch_logfile("a", true)'], ['E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2']) |
24349
21c72f782ae1
patch 8.2.2715: Vim9: tests fail without the channel feature
Bram Moolenaar <Bram@vim.org>
parents:
24258
diff
changeset
|
559 endif |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
560 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
561 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
562 def Test_ch_open() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
563 if !has('channel') |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
564 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
565 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
566 v9.CheckDefAndScriptFailure(['ch_open({"a": 10}, "a")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
567 v9.CheckDefAndScriptFailure(['ch_open("a", [1])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
568 v9.CheckDefExecAndScriptFailure(['ch_open("")'], 'E475: Invalid argument') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
569 endif |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
570 enddef |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
571 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
572 def Test_ch_read() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
573 if !has('channel') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
574 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
575 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
576 v9.CheckDefAndScriptFailure(['ch_read(1)'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
577 v9.CheckDefAndScriptFailure(['ch_read(test_null_channel(), [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
578 endif |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
579 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
580 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
581 def Test_ch_readblob() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
582 if !has('channel') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
583 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
584 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
585 v9.CheckDefAndScriptFailure(['ch_readblob(1)'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
586 v9.CheckDefAndScriptFailure(['ch_readblob(test_null_channel(), [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
587 endif |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
588 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
589 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
590 def Test_ch_readraw() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
591 if !has('channel') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
592 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
593 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
594 v9.CheckDefAndScriptFailure(['ch_readraw(1)'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
595 v9.CheckDefAndScriptFailure(['ch_readraw(test_null_channel(), [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
596 endif |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
597 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
598 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
599 def Test_ch_sendexpr() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
600 if !has('channel') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
601 CheckFeature channel |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
602 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
603 v9.CheckDefAndScriptFailure(['ch_sendexpr(1, "a")'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
604 v9.CheckDefAndScriptFailure(['ch_sendexpr(test_null_channel(), 1, [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
605 endif |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
606 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
607 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
608 def Test_ch_sendraw() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
609 if !has('channel') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
610 CheckFeature channel |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
611 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
612 v9.CheckDefAndScriptFailure(['ch_sendraw(1, "")'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
613 v9.CheckDefAndScriptFailure(['ch_sendraw(test_null_channel(), 1)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1221: String or Blob required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
614 v9.CheckDefAndScriptFailure(['ch_sendraw(test_null_channel(), "", [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
615 endif |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
616 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
617 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
618 def Test_ch_setoptions() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
619 if !has('channel') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
620 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
621 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
622 v9.CheckDefAndScriptFailure(['ch_setoptions(1, {})'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
623 v9.CheckDefAndScriptFailure(['ch_setoptions(test_null_channel(), [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
624 endif |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
625 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
626 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
627 def Test_ch_status() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
628 if !has('channel') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
629 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
630 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
631 v9.CheckDefAndScriptFailure(['ch_status(1)'], ['E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
632 v9.CheckDefAndScriptFailure(['ch_status(test_null_channel(), [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
633 endif |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
634 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
635 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
636 def Test_char2nr() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
637 char2nr('あ', true)->assert_equal(12354) |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
638 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
639 assert_fails('char2nr(true)', 'E1174:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
640 v9.CheckDefAndScriptFailure(['char2nr(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
641 v9.CheckDefAndScriptFailure(['char2nr("a", 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
642 assert_equal(97, char2nr('a', 1)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
643 assert_equal(97, char2nr('a', 0)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
644 assert_equal(97, char2nr('a', true)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
645 assert_equal(97, char2nr('a', false)) |
25806
8d55e978f95b
patch 8.2.3438: cannot manipulate blobs
Bram Moolenaar <Bram@vim.org>
parents:
25784
diff
changeset
|
646 char2nr('')->assert_equal(0) |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
647 enddef |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
648 |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
649 def Test_charclass() |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
650 assert_fails('charclass(true)', 'E1174:') |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
651 charclass('')->assert_equal(0) |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
652 enddef |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
653 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
654 def Test_charcol() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
655 v9.CheckDefAndScriptFailure(['charcol(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
656 v9.CheckDefAndScriptFailure(['charcol({a: 10})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
657 v9.CheckDefExecAndScriptFailure(['charcol("")'], 'E1209: Invalid value for a line number') |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
658 new |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
659 setline(1, ['abcdefgh']) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
660 cursor(1, 4) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
661 assert_equal(4, charcol('.')) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
662 assert_equal(9, charcol([1, '$'])) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
663 assert_equal(0, charcol([10, '$'])) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
664 bw! |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
665 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
666 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
667 def Test_charidx() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
668 v9.CheckDefAndScriptFailure(['charidx(0z10, 1)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
669 v9.CheckDefAndScriptFailure(['charidx("a", "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
670 v9.CheckDefAndScriptFailure(['charidx("a", 1, "")'], ['E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
671 charidx('', 0)->assert_equal(-1) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
672 charidx('', 1)->assert_equal(-1) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
673 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
674 |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
675 def Test_chdir() |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
676 assert_fails('chdir(true)', 'E1174:') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
677 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
678 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
679 def Test_cindent() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
680 v9.CheckDefAndScriptFailure(['cindent([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
681 v9.CheckDefAndScriptFailure(['cindent(null)'], ['E1013: Argument 1: type mismatch, expected string but got special', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
682 v9.CheckDefExecAndScriptFailure(['cindent("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
683 assert_equal(-1, cindent(0)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
684 assert_equal(0, cindent('.')) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
685 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
686 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
687 def Test_clearmatches() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
688 v9.CheckDefAndScriptFailure(['clearmatches("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
689 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
690 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
691 def Test_col() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
692 new |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
693 setline(1, 'abcdefgh') |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
694 cursor(1, 4) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
695 assert_equal(4, col('.')) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
696 col([1, '$'])->assert_equal(9) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
697 assert_equal(0, col([10, '$'])) |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
698 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
699 assert_fails('col(true)', 'E1222:') |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
700 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
701 v9.CheckDefAndScriptFailure(['col(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
702 v9.CheckDefAndScriptFailure(['col({a: 10})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
703 v9.CheckDefAndScriptFailure(['col(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
704 v9.CheckDefExecAndScriptFailure(['col("")'], 'E1209: Invalid value for a line number') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
705 bw! |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
706 enddef |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
707 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
708 def Test_complete() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
709 v9.CheckDefAndScriptFailure(['complete("1", [])'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
710 v9.CheckDefAndScriptFailure(['complete(1, {})'], ['E1013: Argument 2: type mismatch, expected list<any> but got dict<unknown>', 'E1211: List required for argument 2']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
711 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
712 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
713 def Test_complete_add() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
714 v9.CheckDefAndScriptFailure(['complete_add([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1223: String or Dictionary required for argument 1']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
715 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
716 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
717 def Test_complete_info() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
718 v9.CheckDefAndScriptFailure(['complete_info("")'], ['E1013: Argument 1: type mismatch, expected list<string> but got string', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
719 v9.CheckDefAndScriptFailure(['complete_info({})'], ['E1013: Argument 1: type mismatch, expected list<string> but got dict<unknown>', 'E1211: List required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
720 assert_equal({'pum_visible': 0, 'mode': '', 'selected': -1, 'items': []}, complete_info()) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
721 assert_equal({'mode': '', 'items': []}, complete_info(['mode', 'items'])) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
722 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
723 |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
724 def Test_confirm() |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
725 if !has('dialog_con') && !has('dialog_gui') |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
726 CheckFeature dialog_con |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
727 endif |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
728 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
729 assert_fails('confirm(true)', 'E1174:') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
730 assert_fails('confirm("yes", true)', 'E1174:') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
731 assert_fails('confirm("yes", "maybe", 2, true)', 'E1174:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
732 v9.CheckDefAndScriptFailure(['confirm(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
733 v9.CheckDefAndScriptFailure(['confirm("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
734 v9.CheckDefAndScriptFailure(['confirm("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
735 v9.CheckDefAndScriptFailure(['confirm("a", "b", 3, 4)'], ['E1013: Argument 4: type mismatch, expected string but got number', 'E1174: String required for argument 4']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
736 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
737 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
738 def Test_copy_return_type() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
739 var l = copy([1, 2, 3]) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
740 var res = 0 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
741 for n in l |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
742 res += n |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
743 endfor |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
744 res->assert_equal(6) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
745 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
746 var dl = deepcopy([1, 2, 3]) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
747 res = 0 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
748 for n in dl |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
749 res += n |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
750 endfor |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
751 res->assert_equal(6) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
752 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
753 dl = deepcopy([1, 2, 3], true) |
27517
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
754 |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
755 # after a copy() the type can change, but not the item itself |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
756 var nl: list<number> = [1, 2] |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
757 assert_equal([1, 2, 'x'], nl->copy()->extend(['x'])) |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
758 |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
759 var lines =<< trim END |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
760 var nll: list<list<number>> = [[1, 2]] |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
761 nll->copy()[0]->extend(['x']) |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
762 END |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
763 v9.CheckDefExecAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected list<number> but got list<string> in extend()') |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
764 |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
765 var nd: dict<number> = {a: 1, b: 2} |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
766 assert_equal({a: 1, b: 2, c: 'x'}, nd->copy()->extend({c: 'x'})) |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
767 lines =<< trim END |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
768 var ndd: dict<dict<number>> = {a: {x: 1, y: 2}} |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
769 ndd->copy()['a']->extend({z: 'x'}) |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
770 END |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
771 v9.CheckDefExecAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected dict<number> but got dict<string> in extend()') |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
772 |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
773 # after a deepcopy() the item type can also change |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
774 var nll: list<list<number>> = [[1, 2]] |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
775 assert_equal([1, 2, 'x'], nll->deepcopy()[0]->extend(['x'])) |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
776 |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
777 var ndd: dict<dict<number>> = {a: {x: 1, y: 2}} |
f00a7a2bee21
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
778 assert_equal({x: 1, y: 2, z: 'x'}, ndd->deepcopy()['a']->extend({z: 'x'})) |
27549
2397b18d6f94
patch 8.2.4301: Vim9: type error for copy of dict
Bram Moolenaar <Bram@vim.org>
parents:
27517
diff
changeset
|
779 |
2397b18d6f94
patch 8.2.4301: Vim9: type error for copy of dict
Bram Moolenaar <Bram@vim.org>
parents:
27517
diff
changeset
|
780 var ldn: list<dict<number>> = [{a: 0}]->deepcopy() |
2397b18d6f94
patch 8.2.4301: Vim9: type error for copy of dict
Bram Moolenaar <Bram@vim.org>
parents:
27517
diff
changeset
|
781 assert_equal([{a: 0}], ldn) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
782 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
783 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
784 def Test_count() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
785 count('ABC ABC ABC', 'b', true)->assert_equal(3) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
786 count('ABC ABC ABC', 'b', false)->assert_equal(0) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
787 v9.CheckDefAndScriptFailure(['count(10, 1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1225: String, List or Dictionary required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
788 v9.CheckDefAndScriptFailure(['count("a", [1], 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
789 v9.CheckDefAndScriptFailure(['count("a", [1], 0, "b")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
790 count([1, 2, 2, 3], 2)->assert_equal(2) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
791 count([1, 2, 2, 3], 2, false, 2)->assert_equal(1) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
792 count({a: 1.1, b: 2.2, c: 1.1}, 1.1)->assert_equal(2) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
793 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
794 |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
795 def Test_cscope_connection() |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
796 CheckFeature cscope |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
797 assert_equal(0, cscope_connection()) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
798 v9.CheckDefAndScriptFailure(['cscope_connection("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
799 v9.CheckDefAndScriptFailure(['cscope_connection(1, 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
800 v9.CheckDefAndScriptFailure(['cscope_connection(1, "b", 3)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
801 enddef |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
802 |
23276
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
803 def Test_cursor() |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
804 new |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
805 setline(1, range(4)) |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
806 cursor(2, 1) |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
807 assert_equal(2, getcurpos()[1]) |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
808 cursor('$', 1) |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
809 assert_equal(4, getcurpos()[1]) |
25314
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
810 cursor([2, 1]) |
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
811 assert_equal(2, getcurpos()[1]) |
23276
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
812 |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
813 var lines =<< trim END |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
814 cursor('2', 1) |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
815 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
816 v9.CheckDefExecAndScriptFailure(lines, 'E1209:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
817 v9.CheckDefAndScriptFailure(['cursor(0z10, 1)'], ['E1013: Argument 1: type mismatch, expected number but got blob', 'E1224: String, Number or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
818 v9.CheckDefAndScriptFailure(['cursor(1, "2")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
819 v9.CheckDefAndScriptFailure(['cursor(1, 2, "3")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
820 v9.CheckDefExecAndScriptFailure(['cursor("", 2)'], 'E1209: Invalid value for a line number') |
23276
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
821 enddef |
b79cdad3ea2e
patch 8.2.2184: Vim9: no error when using "2" for a line number
Bram Moolenaar <Bram@vim.org>
parents:
23175
diff
changeset
|
822 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
823 def Test_debugbreak() |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
824 CheckMSWindows |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
825 v9.CheckDefAndScriptFailure(['debugbreak("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
826 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
827 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
828 def Test_deepcopy() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
829 v9.CheckDefAndScriptFailure(['deepcopy({}, 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
830 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
831 |
23654
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
832 def Test_delete() |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
833 var res: bool = delete('doesnotexist') |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
834 assert_equal(true, res) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
835 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
836 v9.CheckDefAndScriptFailure(['delete(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
837 v9.CheckDefAndScriptFailure(['delete("a", 10)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
838 v9.CheckDefExecAndScriptFailure(['delete("")'], 'E474: Invalid argument') |
23654
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
839 enddef |
1974c5122506
patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Bram Moolenaar <Bram@vim.org>
parents:
23646
diff
changeset
|
840 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
841 def Test_deletebufline() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
842 v9.CheckDefAndScriptFailure(['deletebufline([], 2)'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
843 v9.CheckDefAndScriptFailure(['deletebufline("a", [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
844 v9.CheckDefAndScriptFailure(['deletebufline("a", 2, 0z10)'], ['E1013: Argument 3: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 3']) |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
845 new |
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
846 setline(1, ['one', 'two']) |
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
847 deletebufline('', 1) |
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
848 getline(1, '$')->assert_equal(['two']) |
26782
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
849 |
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
850 assert_fails('deletebufline("", "$a", "$b")', ['E1030: Using a String as a Number: "$a"', 'E1030: Using a String as a Number: "$a"']) |
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
851 assert_fails('deletebufline("", "$", "$b")', ['E1030: Using a String as a Number: "$b"', 'E1030: Using a String as a Number: "$b"']) |
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
852 |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
853 bwipe! |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
854 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
855 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
856 def Test_diff_filler() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
857 v9.CheckDefAndScriptFailure(['diff_filler([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
858 v9.CheckDefAndScriptFailure(['diff_filler(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
859 v9.CheckDefExecAndScriptFailure(['diff_filler("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
860 assert_equal(0, diff_filler(1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
861 assert_equal(0, diff_filler('.')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
862 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
863 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
864 def Test_diff_hlID() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
865 v9.CheckDefAndScriptFailure(['diff_hlID(0z10, 1)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
866 v9.CheckDefAndScriptFailure(['diff_hlID(1, "a")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
867 v9.CheckDefExecAndScriptFailure(['diff_hlID("", 10)'], 'E1209: Invalid value for a line number') |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
868 enddef |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
869 |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
870 def Test_digraph_get() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
871 v9.CheckDefAndScriptFailure(['digraph_get(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
872 v9.CheckDefExecAndScriptFailure(['digraph_get("")'], 'E1214: Digraph must be just two characters') |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
873 enddef |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
874 |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
875 def Test_digraph_getlist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
876 v9.CheckDefAndScriptFailure(['digraph_getlist(10)'], ['E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
877 v9.CheckDefAndScriptFailure(['digraph_getlist("")'], ['E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
878 enddef |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
879 |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
880 def Test_digraph_set() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
881 v9.CheckDefAndScriptFailure(['digraph_set(10, "a")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
882 v9.CheckDefAndScriptFailure(['digraph_set("ab", 0z10)'], ['E1013: Argument 2: type mismatch, expected string but got blob', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
883 v9.CheckDefExecAndScriptFailure(['digraph_set("", "a")'], 'E1214: Digraph must be just two characters') |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
884 enddef |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
885 |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
886 def Test_digraph_setlist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
887 v9.CheckDefAndScriptFailure(['digraph_setlist("a")'], ['E1013: Argument 1: type mismatch, expected list<string> but got string', 'E1216: digraph_setlist() argument must be a list of lists with two items']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
888 v9.CheckDefAndScriptFailure(['digraph_setlist({})'], ['E1013: Argument 1: type mismatch, expected list<string> but got dict<unknown>', 'E1216: digraph_setlist() argument must be a list of lists with two items']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
889 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
890 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
891 def Test_echoraw() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
892 v9.CheckDefAndScriptFailure(['echoraw(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
893 v9.CheckDefAndScriptFailure(['echoraw(["x"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
894 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
895 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
896 def Test_escape() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
897 v9.CheckDefAndScriptFailure(['escape(10, " ")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
898 v9.CheckDefAndScriptFailure(['escape(true, false)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
899 v9.CheckDefAndScriptFailure(['escape("a", 10)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
900 assert_equal('a\:b', escape("a:b", ":")) |
25806
8d55e978f95b
patch 8.2.3438: cannot manipulate blobs
Bram Moolenaar <Bram@vim.org>
parents:
25784
diff
changeset
|
901 escape('abc', '')->assert_equal('abc') |
8d55e978f95b
patch 8.2.3438: cannot manipulate blobs
Bram Moolenaar <Bram@vim.org>
parents:
25784
diff
changeset
|
902 escape('', ':')->assert_equal('') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
903 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
904 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
905 def Test_eval() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
906 v9.CheckDefAndScriptFailure(['eval(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
907 v9.CheckDefAndScriptFailure(['eval(null)'], ['E1013: Argument 1: type mismatch, expected string but got special', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
908 v9.CheckDefExecAndScriptFailure(['eval("")'], 'E15: Invalid expression') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
909 assert_equal(2, eval('1 + 1')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
910 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
911 |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
912 def Test_executable() |
23175
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
913 assert_false(executable("")) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
914 assert_false(executable(test_null_string())) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
915 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
916 v9.CheckDefExecFailure(['echo executable(123)'], 'E1013:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
917 v9.CheckDefExecFailure(['echo executable(true)'], 'E1013:') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
918 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
919 |
24972
b11f38f77006
patch 8.2.3023: Vim9: arguments for execute() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24812
diff
changeset
|
920 def Test_execute() |
b11f38f77006
patch 8.2.3023: Vim9: arguments for execute() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24812
diff
changeset
|
921 var res = execute("echo 'hello'") |
b11f38f77006
patch 8.2.3023: Vim9: arguments for execute() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24812
diff
changeset
|
922 assert_equal("\nhello", res) |
b11f38f77006
patch 8.2.3023: Vim9: arguments for execute() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24812
diff
changeset
|
923 res = execute(["echo 'here'", "echo 'there'"]) |
b11f38f77006
patch 8.2.3023: Vim9: arguments for execute() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24812
diff
changeset
|
924 assert_equal("\nhere\nthere", res) |
b11f38f77006
patch 8.2.3023: Vim9: arguments for execute() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24812
diff
changeset
|
925 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
926 v9.CheckDefAndScriptFailure(['execute(123)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
927 v9.CheckDefFailure(['execute([123])'], 'E1013: Argument 1: type mismatch, expected list<string> but got list<number>') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
928 v9.CheckDefExecFailure(['echo execute(["xx", 123])'], 'E492') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
929 v9.CheckDefAndScriptFailure(['execute("xx", 123)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
24972
b11f38f77006
patch 8.2.3023: Vim9: arguments for execute() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24812
diff
changeset
|
930 enddef |
b11f38f77006
patch 8.2.3023: Vim9: arguments for execute() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24812
diff
changeset
|
931 |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
932 def Test_exepath() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
933 v9.CheckDefExecFailure(['echo exepath(true)'], 'E1013:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
934 v9.CheckDefExecFailure(['echo exepath(v:null)'], 'E1013:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
935 v9.CheckDefExecFailure(['echo exepath("")'], 'E1175:') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
936 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
937 |
25525
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
938 command DoSomeCommand let g:didSomeCommand = 4 |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
939 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
940 def Test_exists() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
941 v9.CheckDefAndScriptFailure(['exists(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
942 call assert_equal(1, exists('&tabstop')) |
25479
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
943 |
25555
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
944 var lines =<< trim END |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
945 if exists('+newoption') |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
946 if &newoption == 'ok' |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
947 endif |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
948 endif |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
949 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
950 v9.CheckDefFailure(lines, 'E113:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
951 v9.CheckScriptSuccess(lines) |
25555
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
952 enddef |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
953 |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
954 def Test_exists_compiled() |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
955 call assert_equal(1, exists_compiled('&tabstop')) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
956 v9.CheckDefAndScriptFailure(['exists_compiled(10)'], ['E1232:', 'E1233:']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
957 v9.CheckDefAndScriptFailure(['exists_compiled(v:progname)'], ['E1232:', 'E1233:']) |
25555
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
958 |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
959 if exists_compiled('+newoption') |
25479
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
960 if &newoption == 'ok' |
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
961 endif |
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
962 endif |
25555
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
963 if exists_compiled('&newoption') |
25479
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
964 if &newoption == 'ok' |
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
965 endif |
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
966 endif |
25555
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
967 if exists_compiled('+tabstop') |
25479
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
968 assert_equal(8, &tabstop) |
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
969 else |
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
970 assert_report('tabstop option not existing?') |
fbdfa533001c
patch 8.2.3276: Vim9: exists() can only be evaluated at runtime
Bram Moolenaar <Bram@vim.org>
parents:
25449
diff
changeset
|
971 endif |
25555
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
972 if exists_compiled('&tabstop') |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
973 assert_equal(8, &tabstop) |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
974 else |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
975 assert_report('tabstop option not existing?') |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
976 endif |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
977 |
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
978 if exists_compiled(':DoSomeCommand') >= 2 |
25525
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
979 DoSomeCommand |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
980 endif |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
981 assert_equal(4, g:didSomeCommand) |
25555
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
982 if exists_compiled(':NoSuchCommand') >= 2 |
25525
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
983 NoSuchCommand |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
984 endif |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
985 |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
986 var found = false |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
987 if exists_compiled('*CheckFeature') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
988 found = true |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
989 endif |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
990 assert_false(found) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
991 found = false |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
992 if exists_compiled('*g:CheckFeature') |
25525
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
993 found = true |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
994 endif |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
995 assert_true(found) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
996 |
25555
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
997 if exists_compiled('*NoSuchFunction') |
25525
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
998 NoSuchFunction() |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
999 endif |
25555
446f478d6fb1
patch 8.2.3314: behavior of exists() in a :def function is unpredictable
Bram Moolenaar <Bram@vim.org>
parents:
25525
diff
changeset
|
1000 if exists_compiled('*no_such_function') |
25525
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
1001 no_such_function() |
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
1002 endif |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1003 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1004 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1005 def Test_expand() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1006 split SomeFile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1007 expand('%', true, true)->assert_equal(['SomeFile']) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1008 close |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1009 v9.CheckDefAndScriptFailure(['expand(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1010 v9.CheckDefAndScriptFailure(['expand("a", 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1011 v9.CheckDefAndScriptFailure(['expand("a", true, 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
1012 expand('')->assert_equal('') |
26230
8b8470b511f5
patch 8.2.3646: using <sfile> in a function gives an unexpected result
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
1013 |
8b8470b511f5
patch 8.2.3646: using <sfile> in a function gives an unexpected result
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
1014 var caught = false |
8b8470b511f5
patch 8.2.3646: using <sfile> in a function gives an unexpected result
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
1015 try |
8b8470b511f5
patch 8.2.3646: using <sfile> in a function gives an unexpected result
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
1016 echo expand("<sfile>") |
8b8470b511f5
patch 8.2.3646: using <sfile> in a function gives an unexpected result
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
1017 catch /E1245:/ |
8b8470b511f5
patch 8.2.3646: using <sfile> in a function gives an unexpected result
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
1018 caught = true |
8b8470b511f5
patch 8.2.3646: using <sfile> in a function gives an unexpected result
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
1019 endtry |
8b8470b511f5
patch 8.2.3646: using <sfile> in a function gives an unexpected result
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
1020 assert_true(caught) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1021 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1022 |
24584
abc4793f48a3
patch 8.2.2831: Vim9: expandcmd() not tested
Bram Moolenaar <Bram@vim.org>
parents:
24484
diff
changeset
|
1023 def Test_expandcmd() |
abc4793f48a3
patch 8.2.2831: Vim9: expandcmd() not tested
Bram Moolenaar <Bram@vim.org>
parents:
24484
diff
changeset
|
1024 $FOO = "blue" |
abc4793f48a3
patch 8.2.2831: Vim9: expandcmd() not tested
Bram Moolenaar <Bram@vim.org>
parents:
24484
diff
changeset
|
1025 assert_equal("blue sky", expandcmd("`=$FOO .. ' sky'`")) |
abc4793f48a3
patch 8.2.2831: Vim9: expandcmd() not tested
Bram Moolenaar <Bram@vim.org>
parents:
24484
diff
changeset
|
1026 |
abc4793f48a3
patch 8.2.2831: Vim9: expandcmd() not tested
Bram Moolenaar <Bram@vim.org>
parents:
24484
diff
changeset
|
1027 assert_equal("yes", expandcmd("`={a: 'yes'}['a']`")) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1028 expandcmd('')->assert_equal('') |
26907
6f43253463cc
patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
26891
diff
changeset
|
1029 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1030 v9.CheckDefAndScriptFailure(['expandcmd([1])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1']) |
28307
425700af491b
patch 8.2.4679: cannot have expandcmd() give an error message for mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28233
diff
changeset
|
1031 v9.CheckDefAndScriptFailure(['expandcmd("abc", [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
24584
abc4793f48a3
patch 8.2.2831: Vim9: expandcmd() not tested
Bram Moolenaar <Bram@vim.org>
parents:
24484
diff
changeset
|
1032 enddef |
abc4793f48a3
patch 8.2.2831: Vim9: expandcmd() not tested
Bram Moolenaar <Bram@vim.org>
parents:
24484
diff
changeset
|
1033 |
22766
a7082e865ffd
patch 8.2.1931: Vim9: arguments of extend() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
22679
diff
changeset
|
1034 def Test_extend_arg_types() |
23800
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1035 g:number_one = 1 |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1036 g:string_keep = 'keep' |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1037 var lines =<< trim END |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1038 assert_equal([1, 2, 3], extend([1, 2], [3])) |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1039 assert_equal([3, 1, 2], extend([1, 2], [3], 0)) |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1040 assert_equal([1, 3, 2], extend([1, 2], [3], 1)) |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1041 assert_equal([1, 3, 2], extend([1, 2], [3], g:number_one)) |
22766
a7082e865ffd
patch 8.2.1931: Vim9: arguments of extend() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
22679
diff
changeset
|
1042 |
23800
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1043 assert_equal({a: 1, b: 2, c: 3}, extend({a: 1, b: 2}, {c: 3})) |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1044 assert_equal({a: 1, b: 4}, extend({a: 1, b: 2}, {b: 4})) |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1045 assert_equal({a: 1, b: 2}, extend({a: 1, b: 2}, {b: 4}, 'keep')) |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1046 assert_equal({a: 1, b: 2}, extend({a: 1, b: 2}, {b: 4}, g:string_keep)) |
22898
a8bccb0634bc
patch 8.2.1996: Vim9: invalid error for argument of extend()
Bram Moolenaar <Bram@vim.org>
parents:
22766
diff
changeset
|
1047 |
26931
6cdf92e77a91
patch 8.2.3994: Vim9: extend() complains about type when it was not declared
Bram Moolenaar <Bram@vim.org>
parents:
26925
diff
changeset
|
1048 # mix of types is OK without a declaration |
6cdf92e77a91
patch 8.2.3994: Vim9: extend() complains about type when it was not declared
Bram Moolenaar <Bram@vim.org>
parents:
26925
diff
changeset
|
1049 |
23800
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1050 var res: list<dict<any>> |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1051 extend(res, mapnew([1, 2], (_, v) => ({}))) |
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1052 assert_equal([{}, {}], res) |
26937
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
1053 |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
1054 var dany: dict<any> = {a: 0} |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
1055 dany->extend({b: 'x'}) |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
1056 assert_equal({a: 0, b: 'x'}, dany) |
23800
57f0e3fd7c05
patch 8.2.2441: Vim9: extend() does not give an error for a type mismatch
Bram Moolenaar <Bram@vim.org>
parents:
23788
diff
changeset
|
1057 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1058 v9.CheckDefAndScriptSuccess(lines) |
22766
a7082e865ffd
patch 8.2.1931: Vim9: arguments of extend() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
22679
diff
changeset
|
1059 |
26931
6cdf92e77a91
patch 8.2.3994: Vim9: extend() complains about type when it was not declared
Bram Moolenaar <Bram@vim.org>
parents:
26925
diff
changeset
|
1060 lines =<< trim END |
6cdf92e77a91
patch 8.2.3994: Vim9: extend() complains about type when it was not declared
Bram Moolenaar <Bram@vim.org>
parents:
26925
diff
changeset
|
1061 assert_equal([1, 2, "x"], extend([1, 2], ["x"])) |
6cdf92e77a91
patch 8.2.3994: Vim9: extend() complains about type when it was not declared
Bram Moolenaar <Bram@vim.org>
parents:
26925
diff
changeset
|
1062 assert_equal([1, "b", 1], extend([1], ["b", 1])) |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26931
diff
changeset
|
1063 |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26931
diff
changeset
|
1064 assert_equal({a: 1, b: "x"}, extend({a: 1}, {b: "x"})) |
26931
6cdf92e77a91
patch 8.2.3994: Vim9: extend() complains about type when it was not declared
Bram Moolenaar <Bram@vim.org>
parents:
26925
diff
changeset
|
1065 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1066 v9.CheckDefAndScriptSuccess(lines) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1067 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1068 v9.CheckDefAndScriptFailure(['extend("a", 1)'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E712: Argument of extend() must be a List or Dictionary']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1069 v9.CheckDefAndScriptFailure(['extend([1, 2], 3)'], ['E1013: Argument 2: type mismatch, expected list<any> but got number', 'E712: Argument of extend() must be a List or Dictionary']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1070 v9.CheckDefAndScriptFailure(['var ll = [1, 2]', 'extend(ll, ["x"])'], ['E1013: Argument 2: type mismatch, expected list<number> but got list<string>', 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1071 v9.CheckDefFailure(['extend([1, 2], [3], "x")'], 'E1013: Argument 3: type mismatch, expected number but got string') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1072 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1073 v9.CheckDefFailure(['extend({a: 1}, 42)'], 'E1013: Argument 2: type mismatch, expected dict<any> but got number') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1074 v9.CheckDefFailure(['extend({a: 1}, {b: 2}, 1)'], 'E1013: Argument 3: type mismatch, expected string but got number') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1075 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1076 v9.CheckScriptFailure(['vim9script', 'var l = [1]', 'extend(l, ["b", 1])'], 'E1013: Argument 2: type mismatch, expected list<number> but got list<any> in extend()') |
22766
a7082e865ffd
patch 8.2.1931: Vim9: arguments of extend() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
22679
diff
changeset
|
1077 enddef |
a7082e865ffd
patch 8.2.1931: Vim9: arguments of extend() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
22679
diff
changeset
|
1078 |
23458
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1079 func g:ExtendDict(d) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1080 call extend(a:d, #{xx: 'x'}) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1081 endfunc |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1082 |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1083 def Test_extend_dict_item_type() |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1084 var lines =<< trim END |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1085 var d: dict<number> = {a: 1} |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1086 extend(d, {b: 2}) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1087 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1088 v9.CheckDefAndScriptSuccess(lines) |
23458
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1089 |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1090 lines =<< trim END |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1091 var d: dict<number> = {a: 1} |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1092 extend(d, {b: 'x'}) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1093 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1094 v9.CheckDefAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected dict<number> but got dict<string>', 2) |
23458
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1095 |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1096 lines =<< trim END |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1097 var d: dict<number> = {a: 1} |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1098 g:ExtendDict(d) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1099 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1100 v9.CheckDefExecFailure(lines, 'E1012: Type mismatch; expected number but got string', 0) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1101 v9.CheckScriptFailure(['vim9script'] + lines, 'E1012:', 1) |
25571
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1102 |
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1103 lines =<< trim END |
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1104 var d: dict<bool> |
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1105 extend(d, {b: 0}) |
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1106 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1107 v9.CheckDefAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected dict<bool> but got dict<number>', 2) |
23458
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1108 enddef |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1109 |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1110 func g:ExtendList(l) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1111 call extend(a:l, ['x']) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1112 endfunc |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1113 |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1114 def Test_extend_list_item_type() |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1115 var lines =<< trim END |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1116 var l: list<number> = [1] |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1117 extend(l, [2]) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1118 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1119 v9.CheckDefAndScriptSuccess(lines) |
23458
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1120 |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1121 lines =<< trim END |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1122 var l: list<number> = [1] |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1123 extend(l, ['x']) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1124 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1125 v9.CheckDefAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>', 2) |
23458
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1126 |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1127 lines =<< trim END |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1128 var l: list<number> = [1] |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1129 g:ExtendList(l) |
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1130 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1131 v9.CheckDefExecFailure(lines, 'E1012: Type mismatch; expected number but got string', 0) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1132 v9.CheckScriptFailure(['vim9script'] + lines, 'E1012:', 1) |
25571
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1133 |
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1134 lines =<< trim END |
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1135 var l: list<bool> |
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1136 extend(l, [0]) |
951f3e04e238
patch 8.2.3322: Vim9: checking type of dict does not check member type
Bram Moolenaar <Bram@vim.org>
parents:
25555
diff
changeset
|
1137 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1138 v9.CheckDefAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected list<bool> but got list<number>', 2) |
23458
d2b1269c2c68
patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
1139 enddef |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1140 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1141 def Test_extend_return_type() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1142 var l = extend([1, 2], [3]) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1143 var res = 0 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1144 for n in l |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1145 res += n |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1146 endfor |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1147 res->assert_equal(6) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1148 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1149 |
24118
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1150 def Test_extend_with_error_function() |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1151 var lines =<< trim END |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1152 vim9script |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1153 def F() |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1154 { |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1155 var m = 10 |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1156 } |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1157 echo m |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1158 enddef |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1159 |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1160 def Test() |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1161 var d: dict<any> = {} |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1162 d->extend({A: 10, Func: function('F', [])}) |
27728
fdc841530372
patch 8.2.4390: Vim9: list from declaration with inferred type not set
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1163 d.Func() |
24118
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1164 enddef |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1165 |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1166 Test() |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1167 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1168 v9.CheckScriptFailure(lines, 'E1001: Variable not found: m') |
24118
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1169 enddef |
1027495445bc
patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Bram Moolenaar <Bram@vim.org>
parents:
24083
diff
changeset
|
1170 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1171 def Test_extendnew() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1172 assert_equal([1, 2, 'a'], extendnew([1, 2], ['a'])) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1173 assert_equal({one: 1, two: 'a'}, extendnew({one: 1}, {two: 'a'})) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1174 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1175 v9.CheckDefAndScriptFailure(['extendnew({a: 1}, 42)'], ['E1013: Argument 2: type mismatch, expected dict<number> but got number', 'E712: Argument of extendnew() must be a List or Dictionary']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1176 v9.CheckDefAndScriptFailure(['extendnew({a: 1}, [42])'], ['E1013: Argument 2: type mismatch, expected dict<number> but got list<number>', 'E712: Argument of extendnew() must be a List or Dictionary']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1177 v9.CheckDefAndScriptFailure(['extendnew([1, 2], "x")'], ['E1013: Argument 2: type mismatch, expected list<number> but got string', 'E712: Argument of extendnew() must be a List or Dictionary']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1178 v9.CheckDefAndScriptFailure(['extendnew([1, 2], {x: 1})'], ['E1013: Argument 2: type mismatch, expected list<number> but got dict<number>', 'E712: Argument of extendnew() must be a List or Dictionary']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1179 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1180 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1181 def Test_feedkeys() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1182 v9.CheckDefAndScriptFailure(['feedkeys(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1183 v9.CheckDefAndScriptFailure(['feedkeys("x", 10)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1184 v9.CheckDefAndScriptFailure(['feedkeys([], {})'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1185 g:TestVar = 1 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1186 feedkeys(":g:TestVar = 789\n", 'xt') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1187 assert_equal(789, g:TestVar) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1188 unlet g:TestVar |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1189 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1190 |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1191 def Test_filereadable() |
23175
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1192 assert_false(filereadable("")) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1193 assert_false(filereadable(test_null_string())) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1194 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1195 v9.CheckDefExecFailure(['echo filereadable(123)'], 'E1013:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1196 v9.CheckDefExecFailure(['echo filereadable(true)'], 'E1013:') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1197 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1198 |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1199 def Test_filewritable() |
23175
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1200 assert_false(filewritable("")) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1201 assert_false(filewritable(test_null_string())) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1202 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1203 v9.CheckDefExecFailure(['echo filewritable(123)'], 'E1013:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1204 v9.CheckDefExecFailure(['echo filewritable(true)'], 'E1013:') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1205 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1206 |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1207 def Test_finddir() |
25731
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1208 mkdir('Xtestdir') |
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1209 finddir('Xtestdir', '**', -1)->assert_equal(['Xtestdir']) |
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1210 var lines =<< trim END |
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1211 var l: list<string> = finddir('nothing', '*;', -1) |
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1212 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1213 v9.CheckDefAndScriptSuccess(lines) |
25731
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1214 delete('Xtestdir', 'rf') |
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1215 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1216 v9.CheckDefAndScriptFailure(['finddir(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1217 v9.CheckDefAndScriptFailure(['finddir(v:null)'], ['E1013: Argument 1: type mismatch, expected string but got special', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1218 v9.CheckDefExecFailure(['echo finddir("")'], 'E1175:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1219 v9.CheckDefAndScriptFailure(['finddir("a", [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1220 v9.CheckDefAndScriptFailure(['finddir("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1221 finddir('abc', '')->assert_equal('') |
26686
c04b28fad0cc
patch 8.2.3872: Vim9: finddir() and uniq() return types can be more specific
Bram Moolenaar <Bram@vim.org>
parents:
26656
diff
changeset
|
1222 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1223 v9.CheckDefFailure(['var s: list<string> = finddir("foo")'], 'E1012: Type mismatch; expected list<string> but got string') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1224 v9.CheckDefFailure(['var s: list<string> = finddir("foo", "path")'], 'E1012: Type mismatch; expected list<string> but got string') |
26686
c04b28fad0cc
patch 8.2.3872: Vim9: finddir() and uniq() return types can be more specific
Bram Moolenaar <Bram@vim.org>
parents:
26656
diff
changeset
|
1225 # with third argument only runtime type checking |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1226 v9.CheckDefCompileSuccess(['var s: list<string> = finddir("foo", "path", 1)']) |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1227 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1228 |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1229 def Test_findfile() |
25731
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1230 findfile('runtest.vim', '**', -1)->assert_equal(['runtest.vim']) |
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1231 var lines =<< trim END |
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1232 var l: list<string> = findfile('nothing', '*;', -1) |
f35efe44dacd
patch 8.2.3401: Vim9: cannot use negative count with finddir() and findfile()
Bram Moolenaar <Bram@vim.org>
parents:
25692
diff
changeset
|
1233 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1234 v9.CheckDefAndScriptSuccess(lines) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1235 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1236 v9.CheckDefExecFailure(['findfile(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1237 v9.CheckDefExecFailure(['findfile(v:null)'], 'E1013: Argument 1: type mismatch, expected string but got special') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1238 v9.CheckDefExecFailure(['findfile("")'], 'E1175:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1239 v9.CheckDefAndScriptFailure(['findfile("a", [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1240 v9.CheckDefAndScriptFailure(['findfile("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1241 findfile('abc', '')->assert_equal('') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1242 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1243 |
25784
8dfcee931c6c
patch 8.2.3427: double free when list is copied
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1244 def Test_flatten() |
8dfcee931c6c
patch 8.2.3427: double free when list is copied
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1245 var lines =<< trim END |
8dfcee931c6c
patch 8.2.3427: double free when list is copied
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1246 echo flatten([1, 2, 3]) |
8dfcee931c6c
patch 8.2.3427: double free when list is copied
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1247 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1248 v9.CheckDefAndScriptFailure(lines, 'E1158:') |
25784
8dfcee931c6c
patch 8.2.3427: double free when list is copied
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1249 enddef |
8dfcee931c6c
patch 8.2.3427: double free when list is copied
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1250 |
23816
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1251 def Test_flattennew() |
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1252 var lines =<< trim END |
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1253 var l = [1, [2, [3, 4]], 5] |
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1254 call assert_equal([1, 2, 3, 4, 5], flattennew(l)) |
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1255 call assert_equal([1, [2, [3, 4]], 5], l) |
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1256 |
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1257 call assert_equal([1, 2, [3, 4], 5], flattennew(l, 1)) |
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1258 call assert_equal([1, [2, [3, 4]], 5], l) |
25784
8dfcee931c6c
patch 8.2.3427: double free when list is copied
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1259 |
8dfcee931c6c
patch 8.2.3427: double free when list is copied
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1260 var ll: list<list<string>> = [['a', 'b', 'c']] |
8dfcee931c6c
patch 8.2.3427: double free when list is copied
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1261 assert_equal(['a', 'b', 'c'], ll->flattennew()) |
23816
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1262 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1263 v9.CheckDefAndScriptSuccess(lines) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1264 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1265 v9.CheckDefAndScriptFailure(['flattennew({})'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<unknown>', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1266 v9.CheckDefAndScriptFailure(['flattennew([], "1")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
23816
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1267 enddef |
525c9e218c69
patch 8.2.2449: Vim9: flatten() always changes the list type
Bram Moolenaar <Bram@vim.org>
parents:
23804
diff
changeset
|
1268 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1269 " Test for float functions argument type |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1270 def Test_float_funcs_args() |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1271 CheckFeature float |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1272 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1273 # acos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1274 v9.CheckDefAndScriptFailure(['acos("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1275 # asin() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1276 v9.CheckDefAndScriptFailure(['asin("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1277 # atan() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1278 v9.CheckDefAndScriptFailure(['atan("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1279 # atan2() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1280 v9.CheckDefAndScriptFailure(['atan2("a", 1.1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1281 v9.CheckDefAndScriptFailure(['atan2(1.2, "a")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1282 v9.CheckDefAndScriptFailure(['atan2(1.2)'], ['E119:', 'E119:']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1283 # ceil() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1284 v9.CheckDefAndScriptFailure(['ceil("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1285 # cos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1286 v9.CheckDefAndScriptFailure(['cos("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1287 # cosh() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1288 v9.CheckDefAndScriptFailure(['cosh("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1289 # exp() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1290 v9.CheckDefAndScriptFailure(['exp("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1291 # float2nr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1292 v9.CheckDefAndScriptFailure(['float2nr("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1293 # floor() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1294 v9.CheckDefAndScriptFailure(['floor("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1295 # fmod() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1296 v9.CheckDefAndScriptFailure(['fmod(1.1, "a")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1297 v9.CheckDefAndScriptFailure(['fmod("a", 1.1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1298 v9.CheckDefAndScriptFailure(['fmod(1.1)'], ['E119:', 'E119:']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1299 # isinf() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1300 v9.CheckDefAndScriptFailure(['isinf("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1301 # isnan() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1302 v9.CheckDefAndScriptFailure(['isnan("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1303 # log() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1304 v9.CheckDefAndScriptFailure(['log("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1305 # log10() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1306 v9.CheckDefAndScriptFailure(['log10("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1307 # pow() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1308 v9.CheckDefAndScriptFailure(['pow("a", 1.1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1309 v9.CheckDefAndScriptFailure(['pow(1.1, "a")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1310 v9.CheckDefAndScriptFailure(['pow(1.1)'], ['E119:', 'E119:']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1311 # round() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1312 v9.CheckDefAndScriptFailure(['round("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1313 # sin() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1314 v9.CheckDefAndScriptFailure(['sin("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1315 # sinh() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1316 v9.CheckDefAndScriptFailure(['sinh("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1317 # sqrt() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1318 v9.CheckDefAndScriptFailure(['sqrt("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1319 # tan() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1320 v9.CheckDefAndScriptFailure(['tan("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1321 # tanh() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1322 v9.CheckDefAndScriptFailure(['tanh("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1323 # trunc() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1324 v9.CheckDefAndScriptFailure(['trunc("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1325 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1326 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1327 def Test_fnameescape() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1328 v9.CheckDefAndScriptFailure(['fnameescape(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1329 assert_equal('\+a\%b\|', fnameescape('+a%b|')) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1330 fnameescape('')->assert_equal('') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1331 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1332 |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1333 def Test_fnamemodify() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1334 v9.CheckDefSuccess(['echo fnamemodify(test_null_string(), ":p")']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1335 v9.CheckDefSuccess(['echo fnamemodify("", ":p")']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1336 v9.CheckDefSuccess(['echo fnamemodify("file", test_null_string())']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1337 v9.CheckDefSuccess(['echo fnamemodify("file", "")']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1338 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1339 v9.CheckDefExecFailure(['echo fnamemodify(true, ":p")'], 'E1013: Argument 1: type mismatch, expected string but got bool') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1340 v9.CheckDefExecFailure(['echo fnamemodify(v:null, ":p")'], 'E1013: Argument 1: type mismatch, expected string but got special') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1341 v9.CheckDefExecFailure(['echo fnamemodify("file", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1342 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1343 |
23827
7e0d8f1cae7d
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
23816
diff
changeset
|
1344 def Wrong_dict_key_type(items: list<number>): list<number> |
7e0d8f1cae7d
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
23816
diff
changeset
|
1345 return filter(items, (_, val) => get({[val]: 1}, 'x')) |
7e0d8f1cae7d
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
23816
diff
changeset
|
1346 enddef |
7e0d8f1cae7d
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
23816
diff
changeset
|
1347 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
1348 def Test_filter() |
27831
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1349 assert_equal([], filter([1, 2, 3], '0')) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1350 assert_equal([1, 2, 3], filter([1, 2, 3], '1')) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1351 assert_equal({b: 20}, filter({a: 10, b: 20}, 'v:val == 20')) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1352 |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1353 def GetFiltered(): list<number> |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1354 var Odd: func = (_, v) => v % 2 |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1355 return range(3)->filter(Odd) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1356 enddef |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1357 assert_equal([1], GetFiltered()) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1358 |
27865
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1359 var lines =<< trim END |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1360 vim9script |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1361 def Func(): list<string> |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1362 var MatchWord: func: bool = (_, v) => true |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1363 var l = ['xxx'] |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1364 return l->filter(MatchWord) |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1365 enddef |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1366 assert_equal(['xxx'], Func()) |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1367 END |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1368 v9.CheckScriptSuccess(lines) |
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1369 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1370 v9.CheckDefAndScriptFailure(['filter(1.1, "1")'], ['E1013: Argument 1: type mismatch, expected list<any> but got float', 'E1251: List, Dictionary, Blob or String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1371 v9.CheckDefAndScriptFailure(['filter([1, 2], 4)'], ['E1256: String or function required for argument 2', 'E1024: Using a Number as a String']) |
26737
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
1372 |
27865
05d222e5246a
patch 8.2.4458: Vim9: compiling filter() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27847
diff
changeset
|
1373 lines =<< trim END |
26737
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
1374 def F(i: number, v: any): string |
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
1375 return 'bad' |
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
1376 enddef |
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
1377 echo filter([1, 2, 3], F) |
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
1378 END |
27831
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1379 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?any): bool but got func(number, any): string', 'E1135: Using a String as a Bool:']) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1380 |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1381 # check first function argument type |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1382 lines =<< trim END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1383 var l = [1, 2, 3] |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1384 filter(l, (i: string, v: number) => true) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1385 END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1386 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?number): bool but got func(string, number): bool', 'E1013: Argument 1: type mismatch, expected string but got number']) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1387 lines =<< trim END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1388 var d = {a: 1} |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1389 filter(d, (i: number, v: number) => true) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1390 END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1391 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?string, ?number): bool but got func(number, number): bool', 'E1013: Argument 1: type mismatch, expected number but got string']) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1392 lines =<< trim END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1393 var b = 0z1122 |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1394 filter(b, (i: string, v: number) => true) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1395 END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1396 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?number): bool but got func(string, number): bool', 'E1013: Argument 1: type mismatch, expected string but got number']) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1397 lines =<< trim END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1398 var s = 'text' |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1399 filter(s, (i: string, v: string) => true) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1400 END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1401 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?string): bool but got func(string, string): bool', 'E1013: Argument 1: type mismatch, expected string but got number']) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1402 |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1403 # check second function argument type |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1404 lines =<< trim END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1405 var l = [1, 2, 3] |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1406 filter(l, (i: number, v: string) => true) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1407 END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1408 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?number): bool but got func(number, string): bool', 'E1013: Argument 2: type mismatch, expected string but got number']) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1409 lines =<< trim END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1410 var d = {a: 1} |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1411 filter(d, (i: string, v: string) => true) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1412 END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1413 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?string, ?number): bool but got func(string, string): bool', 'E1013: Argument 2: type mismatch, expected string but got number']) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1414 lines =<< trim END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1415 var b = 0z1122 |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1416 filter(b, (i: number, v: string) => true) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1417 END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1418 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?number): bool but got func(number, string): bool', 'E1013: Argument 2: type mismatch, expected string but got number']) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1419 lines =<< trim END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1420 var s = 'text' |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1421 filter(s, (i: number, v: number) => true) |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1422 END |
0a3ab3216b75
patch 8.2.4441: Vim9: function argument of filter() not checked like map()
Bram Moolenaar <Bram@vim.org>
parents:
27800
diff
changeset
|
1423 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?string): bool but got func(number, number): bool', 'E1013: Argument 2: type mismatch, expected number but got string']) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
1424 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
1425 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1426 def Test_filter_wrong_dict_key_type() |
27464
a14c4d3e3260
patch 8.2.4260: Vim9: can still use a global function without g:
Bram Moolenaar <Bram@vim.org>
parents:
27462
diff
changeset
|
1427 assert_fails('g:Wrong_dict_key_type([1, v:null, 3])', 'E1013:') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1428 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1429 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1430 def Test_filter_return_type() |
24414
f539864ba851
patch 8.2.2747: Vim9: not always an error for too many function arguments
Bram Moolenaar <Bram@vim.org>
parents:
24349
diff
changeset
|
1431 var l = filter([1, 2, 3], (_, _) => 1) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1432 var res = 0 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1433 for n in l |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1434 res += n |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1435 endfor |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1436 res->assert_equal(6) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1437 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1438 |
23350
9b86957ddd95
patch 8.2.2218: Vim9: failure if passing more args to lambda than expected
Bram Moolenaar <Bram@vim.org>
parents:
23276
diff
changeset
|
1439 def Test_filter_missing_argument() |
9b86957ddd95
patch 8.2.2218: Vim9: failure if passing more args to lambda than expected
Bram Moolenaar <Bram@vim.org>
parents:
23276
diff
changeset
|
1440 var dict = {aa: [1], ab: [2], ac: [3], de: [4]} |
24414
f539864ba851
patch 8.2.2747: Vim9: not always an error for too many function arguments
Bram Moolenaar <Bram@vim.org>
parents:
24349
diff
changeset
|
1441 var res = dict->filter((k, _) => k =~ 'a' && k !~ 'b') |
23350
9b86957ddd95
patch 8.2.2218: Vim9: failure if passing more args to lambda than expected
Bram Moolenaar <Bram@vim.org>
parents:
23276
diff
changeset
|
1442 res->assert_equal({aa: [1], ac: [3]}) |
9b86957ddd95
patch 8.2.2218: Vim9: failure if passing more args to lambda than expected
Bram Moolenaar <Bram@vim.org>
parents:
23276
diff
changeset
|
1443 enddef |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1444 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1445 def Test_foldclosed() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1446 v9.CheckDefAndScriptFailure(['foldclosed(function("min"))'], ['E1013: Argument 1: type mismatch, expected string but got func(...): unknown', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1447 v9.CheckDefExecAndScriptFailure(['foldclosed("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1448 assert_equal(-1, foldclosed(1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1449 assert_equal(-1, foldclosed('$')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1450 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1451 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1452 def Test_foldclosedend() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1453 v9.CheckDefAndScriptFailure(['foldclosedend(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1454 v9.CheckDefExecAndScriptFailure(['foldclosedend("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1455 assert_equal(-1, foldclosedend(1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1456 assert_equal(-1, foldclosedend('w0')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1457 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1458 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1459 def Test_foldlevel() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1460 v9.CheckDefAndScriptFailure(['foldlevel(0z10)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1461 v9.CheckDefExecAndScriptFailure(['foldlevel("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1462 assert_equal(0, foldlevel(1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1463 assert_equal(0, foldlevel('.')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1464 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1465 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1466 def Test_foldtextresult() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1467 v9.CheckDefAndScriptFailure(['foldtextresult(1.1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1468 v9.CheckDefExecAndScriptFailure(['foldtextresult("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1469 assert_equal('', foldtextresult(1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1470 assert_equal('', foldtextresult('.')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1471 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1472 |
24699
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1473 def Test_fullcommand() |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1474 assert_equal('next', fullcommand('n')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1475 assert_equal('noremap', fullcommand('no')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1476 assert_equal('noremap', fullcommand('nor')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1477 assert_equal('normal', fullcommand('norm')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1478 |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1479 assert_equal('', fullcommand('k')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1480 assert_equal('keepmarks', fullcommand('ke')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1481 assert_equal('keepmarks', fullcommand('kee')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1482 assert_equal('keepmarks', fullcommand('keep')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1483 assert_equal('keepjumps', fullcommand('keepj')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1484 |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1485 assert_equal('dlist', fullcommand('dl')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1486 assert_equal('', fullcommand('dp')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1487 assert_equal('delete', fullcommand('del')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1488 assert_equal('', fullcommand('dell')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1489 assert_equal('', fullcommand('delp')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1490 |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1491 assert_equal('srewind', fullcommand('sre')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1492 assert_equal('scriptnames', fullcommand('scr')) |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1493 assert_equal('', fullcommand('scg')) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
1494 fullcommand('')->assert_equal('') |
24699
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1495 enddef |
b19c8150ee9d
patch 8.2.2888: Vim9: "k" command recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
24695
diff
changeset
|
1496 |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
1497 def Test_funcref() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1498 v9.CheckDefAndScriptFailure(['funcref("reverse", 2)'], ['E1013: Argument 2: type mismatch, expected list<any> but got number', 'E1211: List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1499 v9.CheckDefAndScriptFailure(['funcref("reverse", [2], [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
26656
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1500 |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1501 var lines =<< trim END |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1502 vim9script |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1503 def UseBool(b: bool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1504 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1505 def GetRefOk() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1506 var Ref1: func(bool) = funcref(UseBool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1507 var Ref2: func(bool) = funcref('UseBool') |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1508 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1509 def GetRefBad() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1510 # only fails at runtime |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1511 var Ref1: func(number) = funcref(UseBool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1512 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1513 defcompile |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1514 GetRefOk() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1515 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1516 v9.CheckScriptSuccess(lines) |
26656
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1517 |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1518 lines =<< trim END |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1519 vim9script |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1520 def UseBool(b: bool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1521 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1522 def GetRefBad() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1523 # only fails at runtime |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1524 var Ref1: func(number) = funcref(UseBool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1525 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1526 GetRefBad() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1527 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1528 v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected func(number) but got func(bool)') |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
1529 enddef |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
1530 |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
1531 def Test_function() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1532 v9.CheckDefExecAndScriptFailure(['function(123)'], 'E1256: String or function required for argument 1') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1533 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1534 v9.CheckDefAndScriptFailure(['function("reverse", 2)'], ['E1013: Argument 2: type mismatch, expected list<any> but got number', 'E1211: List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1535 v9.CheckDefAndScriptFailure(['function("reverse", [2], [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
26656
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1536 |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1537 var lines =<< trim END |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1538 vim9script |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1539 def UseBool(b: bool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1540 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1541 def GetRefOk() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1542 var Ref1: func(bool) = function(UseBool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1543 var Ref2: func(bool) = function('UseBool') |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1544 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1545 def GetRefBad() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1546 # only fails at runtime |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1547 var Ref1: func(number) = function(UseBool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1548 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1549 defcompile |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1550 GetRefOk() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1551 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1552 v9.CheckScriptSuccess(lines) |
26656
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1553 |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1554 lines =<< trim END |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1555 vim9script |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1556 def UseBool(b: bool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1557 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1558 def GetRefBad() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1559 # only fails at runtime |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1560 var Ref1: func(number) = function(UseBool) |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1561 enddef |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1562 GetRefBad() |
ab46f0976435
patch 8.2.3857: Vim9: inconsistent error for using function()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
1563 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1564 v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected func(number) but got func(bool)') |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
1565 enddef |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
1566 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1567 def Test_garbagecollect() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1568 garbagecollect(true) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1569 v9.CheckDefAndScriptFailure(['garbagecollect("1")'], ['E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1570 v9.CheckDefAndScriptFailure(['garbagecollect(20)'], ['E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1571 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1572 |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1573 def Test_get() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1574 v9.CheckDefAndScriptFailure(['get("a", 1)'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E896: Argument of get() must be a List, Dictionary or Blob']) |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1575 [3, 5, 2]->get(1)->assert_equal(5) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1576 [3, 5, 2]->get(3)->assert_equal(0) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1577 [3, 5, 2]->get(3, 9)->assert_equal(9) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1578 assert_equal(get(0z102030, 2), 0x30) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1579 {a: 7, b: 11, c: 13}->get('c')->assert_equal(13) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1580 {10: 'a', 20: 'b', 30: 'd'}->get(20)->assert_equal('b') |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1581 function('max')->get('name')->assert_equal('max') |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1582 var F: func = function('min', [[5, 8, 6]]) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1583 F->get('name')->assert_equal('min') |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1584 F->get('args')->assert_equal([[5, 8, 6]]) |
25386
9c749ad22565
patch 8.2.3230: Vim9: type error when function return type is not known yet
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1585 |
9c749ad22565
patch 8.2.3230: Vim9: type error when function return type is not known yet
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1586 var lines =<< trim END |
9c749ad22565
patch 8.2.3230: Vim9: type error when function return type is not known yet
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1587 vim9script |
9c749ad22565
patch 8.2.3230: Vim9: type error when function return type is not known yet
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1588 def DoThat(): number |
9c749ad22565
patch 8.2.3230: Vim9: type error when function return type is not known yet
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1589 var Getqflist: func = function('getqflist', [{id: 42}]) |
9c749ad22565
patch 8.2.3230: Vim9: type error when function return type is not known yet
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1590 return Getqflist()->get('id', 77) |
9c749ad22565
patch 8.2.3230: Vim9: type error when function return type is not known yet
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1591 enddef |
9c749ad22565
patch 8.2.3230: Vim9: type error when function return type is not known yet
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1592 assert_equal(0, DoThat()) |
9c749ad22565
patch 8.2.3230: Vim9: type error when function return type is not known yet
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1593 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1594 v9.CheckScriptSuccess(lines) |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1595 enddef |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
1596 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1597 def Test_getbufinfo() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1598 var bufinfo = getbufinfo(bufnr()) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1599 getbufinfo('%')->assert_equal(bufinfo) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1600 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1601 edit Xtestfile1 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1602 hide edit Xtestfile2 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1603 hide enew |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
1604 getbufinfo({bufloaded: true, buflisted: true, bufmodified: false}) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1605 ->len()->assert_equal(3) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1606 bwipe Xtestfile1 Xtestfile2 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1607 v9.CheckDefAndScriptFailure(['getbufinfo(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1608 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1609 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1610 def Test_getbufline() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1611 e SomeFile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1612 var buf = bufnr() |
25654
ef38fc02faaa
patch 8.2.3363: when :edit reuses the current buffer the alternate file is set
Bram Moolenaar <Bram@vim.org>
parents:
25640
diff
changeset
|
1613 sp Otherfile |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1614 var lines = ['aaa', 'bbb', 'ccc'] |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1615 setbufline(buf, 1, lines) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1616 getbufline('#', 1, '$')->assert_equal(lines) |
22679
9fa3f92248f6
patch 8.2.1888: Vim9: getbufline(-1, 1, '$') gives an error
Bram Moolenaar <Bram@vim.org>
parents:
22661
diff
changeset
|
1617 getbufline(-1, '$', '$')->assert_equal([]) |
9fa3f92248f6
patch 8.2.1888: Vim9: getbufline(-1, 1, '$') gives an error
Bram Moolenaar <Bram@vim.org>
parents:
22661
diff
changeset
|
1618 getbufline(-1, 1, '$')->assert_equal([]) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1619 |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1620 assert_equal([7, 7, 7], getbufline('#', 1, '$')->map((_, _) => 7)) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1621 |
26782
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
1622 assert_fails('getbufline("", "$a", "$b")', ['E1030: Using a String as a Number: "$a"', 'E1030: Using a String as a Number: "$a"']) |
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
1623 assert_fails('getbufline("", "$", "$b")', ['E1030: Using a String as a Number: "$b"', 'E1030: Using a String as a Number: "$b"']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1624 bwipe! |
26782
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
1625 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1626 v9.CheckDefAndScriptFailure(['getbufline([], 2)'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1627 v9.CheckDefAndScriptFailure(['getbufline("a", [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1628 v9.CheckDefAndScriptFailure(['getbufline("a", 2, 0z10)'], ['E1013: Argument 3: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 3']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1629 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1630 |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
1631 def Test_getbufvar() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1632 v9.CheckDefAndScriptFailure(['getbufvar(true, "v")'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1633 v9.CheckDefAndScriptFailure(['getbufvar(1, 2, 3)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
1634 enddef |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
1635 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1636 def Test_getchangelist() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1637 new |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1638 setline(1, 'some text') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1639 var changelist = bufnr()->getchangelist() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1640 getchangelist('%')->assert_equal(changelist) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1641 bwipe! |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1642 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1643 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1644 def Test_getchar() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1645 while getchar(0) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1646 endwhile |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1647 getchar(true)->assert_equal(0) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1648 getchar(1)->assert_equal(0) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1649 v9.CheckDefAndScriptFailure(['getchar(2)'], ['E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1650 v9.CheckDefAndScriptFailure(['getchar("1")'], ['E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1651 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1652 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1653 def Test_getcharpos() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1654 assert_equal(['x', 'x', 'x', 'x'], getcharpos('.')->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1655 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1656 v9.CheckDefAndScriptFailure(['getcharpos(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1657 v9.CheckDefAndScriptFailure(['getcharpos(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1658 v9.CheckDefExecAndScriptFailure(['getcharpos("")'], 'E1209: Invalid value for a line number') |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1659 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1660 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1661 def Test_getcharstr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1662 v9.CheckDefAndScriptFailure(['getcharstr(2)'], ['E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1663 v9.CheckDefAndScriptFailure(['getcharstr("1")'], ['E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1664 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1665 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1666 def Test_getcompletion() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1667 set wildignore=*.vim,*~ |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1668 var l = getcompletion('run', 'file', true) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1669 l->assert_equal([]) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1670 set wildignore& |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1671 v9.CheckDefAndScriptFailure(['getcompletion(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1672 v9.CheckDefAndScriptFailure(['getcompletion("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1673 v9.CheckDefAndScriptFailure(['getcompletion("a", "b", 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1674 v9.CheckDefExecAndScriptFailure(['getcompletion("a", "")'], 'E475: Invalid argument') |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
1675 getcompletion('', 'messages')->assert_equal(['clear']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1676 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1677 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1678 def Test_getcurpos() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1679 assert_equal(['x', 'x', 'x', 'x', 'x'], getcurpos()->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1680 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1681 v9.CheckDefAndScriptFailure(['getcurpos("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1682 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1683 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1684 def Test_getcursorcharpos() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1685 assert_equal(['x', 'x', 'x', 'x', 'x'], getcursorcharpos()->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1686 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1687 v9.CheckDefAndScriptFailure(['getcursorcharpos("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1688 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1689 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1690 def Test_getcwd() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1691 v9.CheckDefAndScriptFailure(['getcwd("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1692 v9.CheckDefAndScriptFailure(['getcwd("x", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1693 v9.CheckDefAndScriptFailure(['getcwd(1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1694 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1695 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1696 def Test_getenv() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1697 if getenv('does-not_exist') == '' |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1698 assert_report('getenv() should return null') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1699 endif |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1700 if getenv('does-not_exist') == null |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1701 else |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1702 assert_report('getenv() should return null') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1703 endif |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1704 $SOMEENVVAR = 'some' |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1705 assert_equal('some', getenv('SOMEENVVAR')) |
28008
cc7d54a134e4
patch 8.2.4529: Vim9: comparing partial with function fails
Bram Moolenaar <Bram@vim.org>
parents:
27867
diff
changeset
|
1706 assert_notequal(null, getenv('SOMEENVVAR')) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1707 unlet $SOMEENVVAR |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1708 getenv('')->assert_equal(v:null) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1709 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1710 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1711 def Test_getfontname() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1712 v9.CheckDefAndScriptFailure(['getfontname(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1713 #getfontname('')->assert_equal('') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1714 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1715 |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1716 def Test_getfperm() |
23175
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1717 assert_equal('', getfperm("")) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1718 assert_equal('', getfperm(test_null_string())) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1719 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1720 v9.CheckDefExecFailure(['echo getfperm(true)'], 'E1013:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1721 v9.CheckDefExecFailure(['echo getfperm(v:null)'], 'E1013:') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1722 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1723 |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1724 def Test_getfsize() |
23175
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1725 assert_equal(-1, getfsize("")) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1726 assert_equal(-1, getfsize(test_null_string())) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1727 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1728 v9.CheckDefExecFailure(['echo getfsize(true)'], 'E1013:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1729 v9.CheckDefExecFailure(['echo getfsize(v:null)'], 'E1013:') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1730 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1731 |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1732 def Test_getftime() |
23175
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1733 assert_equal(-1, getftime("")) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1734 assert_equal(-1, getftime(test_null_string())) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1735 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1736 v9.CheckDefExecFailure(['echo getftime(true)'], 'E1013:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1737 v9.CheckDefExecFailure(['echo getftime(v:null)'], 'E1013:') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1738 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1739 |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1740 def Test_getftype() |
23175
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1741 assert_equal('', getftype("")) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1742 assert_equal('', getftype(test_null_string())) |
d7294a6220ac
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Bram Moolenaar <Bram@vim.org>
parents:
23142
diff
changeset
|
1743 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1744 v9.CheckDefExecFailure(['echo getftype(true)'], 'E1013:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1745 v9.CheckDefExecFailure(['echo getftype(v:null)'], 'E1013:') |
23142
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1746 enddef |
5f08d4a42898
patch 8.2.2117: some functions use any value as a string
Bram Moolenaar <Bram@vim.org>
parents:
23104
diff
changeset
|
1747 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1748 def Test_getjumplist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1749 v9.CheckDefAndScriptFailure(['getjumplist("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1750 v9.CheckDefAndScriptFailure(['getjumplist("x", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1751 v9.CheckDefAndScriptFailure(['getjumplist(1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1752 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1753 |
25216
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1754 def Test_getline() |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1755 var lines =<< trim END |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1756 new |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1757 setline(1, ['hello', 'there', 'again']) |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1758 assert_equal('hello', getline(1)) |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1759 assert_equal('hello', getline('.')) |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1760 |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1761 normal 2Gvjv |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1762 assert_equal('there', getline("'<")) |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1763 assert_equal('again', getline("'>")) |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1764 |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1765 assert_equal([3, 3, 3], getline(1, 3)->map((_, _) => 3)) |
25216
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1766 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1767 v9.CheckDefAndScriptSuccess(lines) |
25216
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1768 |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1769 lines =<< trim END |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1770 echo getline('1') |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1771 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1772 v9.CheckDefExecAndScriptFailure(lines, 'E1209:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1773 v9.CheckDefAndScriptFailure(['getline(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1774 v9.CheckDefAndScriptFailure(['getline(1, true)'], ['E1013: Argument 2: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1775 v9.CheckDefExecAndScriptFailure(['getline("")'], 'E1209: Invalid value for a line number') |
25216
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1776 enddef |
9ead67e3c696
patch 8.2.3144: Vim9: no error when using an invalid value for a line number
Bram Moolenaar <Bram@vim.org>
parents:
25212
diff
changeset
|
1777 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1778 def Test_getloclist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1779 v9.CheckDefAndScriptFailure(['getloclist("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1780 v9.CheckDefAndScriptFailure(['getloclist(1, [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1781 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1782 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1783 def Test_getloclist_return_type() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1784 var l = getloclist(1) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1785 l->assert_equal([]) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1786 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1787 var d = getloclist(1, {items: 0}) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1788 d->assert_equal({items: []}) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1789 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1790 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1791 def Test_getmarklist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1792 v9.CheckDefAndScriptFailure(['getmarklist([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1793 assert_equal([], getmarklist(10000)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1794 assert_fails('getmarklist("a%b@#")', 'E94:') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1795 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1796 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1797 def Test_getmatches() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1798 v9.CheckDefAndScriptFailure(['getmatches("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1799 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1800 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1801 def Test_getpos() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1802 assert_equal(['x', 'x', 'x', 'x'], getpos('.')->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1803 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1804 v9.CheckDefAndScriptFailure(['getpos(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1805 assert_equal([0, 1, 1, 0], getpos('.')) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1806 v9.CheckDefExecFailure(['getpos("a")'], 'E1209:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1807 v9.CheckDefExecAndScriptFailure(['getpos("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1808 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1809 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1810 def Test_getqflist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1811 v9.CheckDefAndScriptFailure(['getqflist([])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1812 call assert_equal({}, getqflist({})) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1813 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1814 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1815 def Test_getqflist_return_type() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1816 var l = getqflist() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1817 l->assert_equal([]) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1818 |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
1819 var d = getqflist({items: 0}) |
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
1820 d->assert_equal({items: []}) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1821 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1822 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1823 def Test_getreg() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1824 var lines = ['aaa', 'bbb', 'ccc'] |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1825 setreg('a', lines) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1826 getreg('a', true, true)->assert_equal(lines) |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1827 assert_equal([7, 7, 7], getreg('a', true, true)->map((_, _) => 7)) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1828 |
23909
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1829 assert_fails('getreg("ab")', 'E1162:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1830 v9.CheckDefAndScriptFailure(['getreg(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1831 v9.CheckDefAndScriptFailure(['getreg(".", 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1832 v9.CheckDefAndScriptFailure(['getreg(".", 1, "b")'], ['E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1833 @" = 'A1B2C3' |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1834 getreg('')->assert_equal('A1B2C3') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1835 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1836 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1837 def Test_getreg_return_type() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1838 var s1: string = getreg('"') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1839 var s2: string = getreg('"', 1) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1840 var s3: list<string> = getreg('"', 1, 1) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1841 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1842 |
23909
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1843 def Test_getreginfo() |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1844 var text = 'abc' |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1845 setreg('a', text) |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1846 getreginfo('a')->assert_equal({regcontents: [text], regtype: 'v', isunnamed: false}) |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1847 assert_fails('getreginfo("ab")', 'E1162:') |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1848 @" = 'D1E2F3' |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1849 getreginfo('').regcontents->assert_equal(['D1E2F3']) |
23909
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1850 enddef |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1851 |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1852 def Test_getregtype() |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1853 var lines = ['aaa', 'bbb', 'ccc'] |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1854 setreg('a', lines) |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1855 getregtype('a')->assert_equal('V') |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1856 assert_fails('getregtype("ab")', 'E1162:') |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1857 setreg('"', 'ABCD', 'b') |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1858 getregtype('')->assert_equal("\<C-V>4") |
23909
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1859 enddef |
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
1860 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1861 def Test_gettabinfo() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1862 v9.CheckDefAndScriptFailure(['gettabinfo("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1863 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1864 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1865 def Test_gettabvar() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1866 v9.CheckDefAndScriptFailure(['gettabvar("a", "b")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1867 v9.CheckDefAndScriptFailure(['gettabvar(1, 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1868 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1869 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1870 def Test_gettabwinvar() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1871 v9.CheckDefAndScriptFailure(['gettabwinvar("a", 2, "c")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1872 v9.CheckDefAndScriptFailure(['gettabwinvar(1, "b", "c", [])'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1873 v9.CheckDefAndScriptFailure(['gettabwinvar(1, 1, 3, {})'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1874 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1875 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1876 def Test_gettagstack() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1877 v9.CheckDefAndScriptFailure(['gettagstack("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1878 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1879 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1880 def Test_gettext() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1881 v9.CheckDefAndScriptFailure(['gettext(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1882 v9.CheckDefExecAndScriptFailure(['gettext("")'], 'E475: Invalid argument') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1883 assert_equal('abc', gettext("abc")) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1884 assert_fails('gettext("")', 'E475:') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1885 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1886 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1887 def Test_getwininfo() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1888 v9.CheckDefAndScriptFailure(['getwininfo("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1889 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1890 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1891 def Test_getwinpos() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1892 assert_equal(['x', 'x'], getwinpos()->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
1893 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1894 v9.CheckDefAndScriptFailure(['getwinpos("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1895 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1896 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1897 def Test_getwinvar() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1898 v9.CheckDefAndScriptFailure(['getwinvar("a", "b")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1899 v9.CheckDefAndScriptFailure(['getwinvar(1, 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1900 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
1901 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1902 def Test_glob() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1903 glob('runtest.vim', true, true, true)->assert_equal(['runtest.vim']) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1904 v9.CheckDefAndScriptFailure(['glob(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1905 v9.CheckDefAndScriptFailure(['glob("a", 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1906 v9.CheckDefAndScriptFailure(['glob("a", 1, "b")'], ['E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1907 v9.CheckDefAndScriptFailure(['glob("a", 1, true, 2)'], ['E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1908 glob('')->assert_equal('') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1909 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1910 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1911 def Test_glob2regpat() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1912 v9.CheckDefAndScriptFailure(['glob2regpat(null)'], ['E1013: Argument 1: type mismatch, expected string but got special', 'E1174: String required for argument 1']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1913 glob2regpat('')->assert_equal('^$') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1914 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1915 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1916 def Test_globpath() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1917 globpath('.', 'runtest.vim', true, true, true)->assert_equal(['./runtest.vim']) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1918 v9.CheckDefAndScriptFailure(['globpath(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1919 v9.CheckDefAndScriptFailure(['globpath("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1920 v9.CheckDefAndScriptFailure(['globpath("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1921 v9.CheckDefAndScriptFailure(['globpath("a", "b", true, "d")'], ['E1013: Argument 4: type mismatch, expected bool but got string', 'E1212: Bool required for argument 4']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1922 v9.CheckDefAndScriptFailure(['globpath("a", "b", true, false, "e")'], ['E1013: Argument 5: type mismatch, expected bool but got string', 'E1212: Bool required for argument 5']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1923 globpath('', '')->assert_equal('') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1924 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1925 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1926 def Test_has() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1927 has('eval', true)->assert_equal(1) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1928 v9.CheckDefAndScriptFailure(['has(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1929 v9.CheckDefAndScriptFailure(['has("a", "b")'], ['E1013: Argument 2: type mismatch, expected bool but got string', 'E1212: Bool required for argument 2']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1930 has('')->assert_equal(0) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1931 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1932 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
1933 def Test_has_key() |
25212
79eb112b492d
patch 8.2.3142: Vim9: type check for has_key() argument is too strict
Bram Moolenaar <Bram@vim.org>
parents:
25198
diff
changeset
|
1934 var d = {123: 'xx'} |
79eb112b492d
patch 8.2.3142: Vim9: type check for has_key() argument is too strict
Bram Moolenaar <Bram@vim.org>
parents:
25198
diff
changeset
|
1935 assert_true(has_key(d, '123')) |
79eb112b492d
patch 8.2.3142: Vim9: type check for has_key() argument is too strict
Bram Moolenaar <Bram@vim.org>
parents:
25198
diff
changeset
|
1936 assert_true(has_key(d, 123)) |
79eb112b492d
patch 8.2.3142: Vim9: type check for has_key() argument is too strict
Bram Moolenaar <Bram@vim.org>
parents:
25198
diff
changeset
|
1937 assert_false(has_key(d, 'x')) |
79eb112b492d
patch 8.2.3142: Vim9: type check for has_key() argument is too strict
Bram Moolenaar <Bram@vim.org>
parents:
25198
diff
changeset
|
1938 assert_false(has_key(d, 99)) |
79eb112b492d
patch 8.2.3142: Vim9: type check for has_key() argument is too strict
Bram Moolenaar <Bram@vim.org>
parents:
25198
diff
changeset
|
1939 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1940 v9.CheckDefAndScriptFailure(['has_key([1, 2], "k")'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1941 v9.CheckDefAndScriptFailure(['has_key({"a": 10}, ["a"])'], ['E1013: Argument 2: type mismatch, expected string but got list<string>', 'E1220: String or Number required for argument 2']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
1942 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
1943 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1944 def Test_haslocaldir() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1945 v9.CheckDefAndScriptFailure(['haslocaldir("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1946 v9.CheckDefAndScriptFailure(['haslocaldir("x", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1947 v9.CheckDefAndScriptFailure(['haslocaldir(1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1948 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
1949 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1950 def Test_hasmapto() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1951 hasmapto('foobar', 'i', true)->assert_equal(0) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1952 iabbrev foo foobar |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1953 hasmapto('foobar', 'i', true)->assert_equal(1) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1954 iunabbrev foo |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1955 v9.CheckDefAndScriptFailure(['hasmapto(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1956 v9.CheckDefAndScriptFailure(['hasmapto("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1957 v9.CheckDefAndScriptFailure(['hasmapto("a", "b", 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1958 hasmapto('', '')->assert_equal(0) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1959 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1960 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1961 def Test_histadd() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1962 v9.CheckDefAndScriptFailure(['histadd(1, "x")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1963 v9.CheckDefAndScriptFailure(['histadd(":", 10)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1964 histadd("search", 'skyblue') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1965 assert_equal('skyblue', histget('/', -1)) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
1966 histadd("search", '')->assert_equal(0) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1967 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1968 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
1969 def Test_histdel() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1970 v9.CheckDefAndScriptFailure(['histdel(1, "x")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1971 v9.CheckDefAndScriptFailure(['histdel(":", true)'], ['E1013: Argument 2: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 2']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
1972 histdel('search', '')->assert_equal(0) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
1973 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
1974 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1975 def Test_histget() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1976 v9.CheckDefAndScriptFailure(['histget(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1977 v9.CheckDefAndScriptFailure(['histget("a", "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1978 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
1979 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1980 def Test_histnr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1981 v9.CheckDefAndScriptFailure(['histnr(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1982 assert_equal(-1, histnr('abc')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1983 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1984 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1985 def Test_hlID() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1986 v9.CheckDefAndScriptFailure(['hlID(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1987 assert_equal(0, hlID('NonExistingHighlight')) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1988 hlID('')->assert_equal(0) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1989 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1990 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1991 def Test_hlexists() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1992 v9.CheckDefAndScriptFailure(['hlexists([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1993 assert_equal(0, hlexists('NonExistingHighlight')) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
1994 hlexists('')->assert_equal(0) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1995 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1996 |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
25850
diff
changeset
|
1997 def Test_hlget() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1998 v9.CheckDefAndScriptFailure(['hlget([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1']) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
25850
diff
changeset
|
1999 hlget('')->assert_equal([]) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
25850
diff
changeset
|
2000 enddef |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
25850
diff
changeset
|
2001 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
25850
diff
changeset
|
2002 def Test_hlset() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2003 v9.CheckDefAndScriptFailure(['hlset("id")'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1']) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
25850
diff
changeset
|
2004 hlset([])->assert_equal(0) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
25850
diff
changeset
|
2005 enddef |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
25850
diff
changeset
|
2006 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2007 def Test_iconv() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2008 v9.CheckDefAndScriptFailure(['iconv(1, "from", "to")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2009 v9.CheckDefAndScriptFailure(['iconv("abc", 10, "to")'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2010 v9.CheckDefAndScriptFailure(['iconv("abc", "from", 20)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2011 assert_equal('abc', iconv('abc', 'fromenc', 'toenc')) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2012 iconv('', '', '')->assert_equal('') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2013 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2014 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2015 def Test_indent() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2016 v9.CheckDefAndScriptFailure(['indent([1])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2017 v9.CheckDefAndScriptFailure(['indent(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2018 v9.CheckDefExecAndScriptFailure(['indent("")'], 'E1209: Invalid value for a line number') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2019 v9.CheckDefExecAndScriptFailure(['indent(-1)'], 'E966: Invalid line number: -1') |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2020 assert_equal(0, indent(1)) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2021 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2022 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2023 def Test_index() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2024 index(['a', 'b', 'a', 'B'], 'b', 2, true)->assert_equal(3) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2025 v9.CheckDefAndScriptFailure(['index("a", "a")'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1226: List or Blob required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2026 v9.CheckDefFailure(['index(["1"], 1)'], 'E1013: Argument 2: type mismatch, expected string but got number') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2027 v9.CheckDefAndScriptFailure(['index(0z10, "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2028 v9.CheckDefAndScriptFailure(['index([1], 1, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2029 v9.CheckDefAndScriptFailure(['index(0z1020, 10, 1, 2)'], ['E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2030 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2031 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2032 def Test_input() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2033 v9.CheckDefAndScriptFailure(['input(5)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2034 v9.CheckDefAndScriptFailure(['input(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2035 v9.CheckDefAndScriptFailure(['input("p", 10)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2036 v9.CheckDefAndScriptFailure(['input("p", "q", 20)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2037 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2038 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2039 def Test_inputdialog() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2040 v9.CheckDefAndScriptFailure(['inputdialog(5)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2041 v9.CheckDefAndScriptFailure(['inputdialog(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2042 v9.CheckDefAndScriptFailure(['inputdialog("p", 10)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2043 v9.CheckDefAndScriptFailure(['inputdialog("p", "q", 20)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2044 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2045 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2046 def Test_inputlist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2047 v9.CheckDefAndScriptFailure(['inputlist(10)'], ['E1013: Argument 1: type mismatch, expected list<string> but got number', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2048 v9.CheckDefAndScriptFailure(['inputlist("abc")'], ['E1013: Argument 1: type mismatch, expected list<string> but got string', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2049 v9.CheckDefFailure(['inputlist([1, 2, 3])'], 'E1013: Argument 1: type mismatch, expected list<string> but got list<number>') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2050 feedkeys("2\<CR>", 't') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2051 var r: number = inputlist(['a', 'b', 'c']) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2052 assert_equal(2, r) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2053 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2054 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2055 def Test_inputsecret() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2056 v9.CheckDefAndScriptFailure(['inputsecret(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2057 v9.CheckDefAndScriptFailure(['inputsecret("Pass:", 20)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2058 feedkeys("\<CR>", 't') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2059 var ans: string = inputsecret('Pass:', '123') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2060 assert_equal('123', ans) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2061 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2062 |
22898
a8bccb0634bc
patch 8.2.1996: Vim9: invalid error for argument of extend()
Bram Moolenaar <Bram@vim.org>
parents:
22766
diff
changeset
|
2063 let s:number_one = 1 |
a8bccb0634bc
patch 8.2.1996: Vim9: invalid error for argument of extend()
Bram Moolenaar <Bram@vim.org>
parents:
22766
diff
changeset
|
2064 let s:number_two = 2 |
a8bccb0634bc
patch 8.2.1996: Vim9: invalid error for argument of extend()
Bram Moolenaar <Bram@vim.org>
parents:
22766
diff
changeset
|
2065 let s:string_keep = 'keep' |
a8bccb0634bc
patch 8.2.1996: Vim9: invalid error for argument of extend()
Bram Moolenaar <Bram@vim.org>
parents:
22766
diff
changeset
|
2066 |
22661
c6b17787a38f
patch 8.2.1879: Vim9: argument types of insert() not checked when compiling
Bram Moolenaar <Bram@vim.org>
parents:
22655
diff
changeset
|
2067 def Test_insert() |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2068 var l = insert([2, 1], 3) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2069 var res = 0 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2070 for n in l |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2071 res += n |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2072 endfor |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2073 res->assert_equal(6) |
22661
c6b17787a38f
patch 8.2.1879: Vim9: argument types of insert() not checked when compiling
Bram Moolenaar <Bram@vim.org>
parents:
22655
diff
changeset
|
2074 |
24695
13efbfc53054
patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24659
diff
changeset
|
2075 var m: any = [] |
13efbfc53054
patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24659
diff
changeset
|
2076 insert(m, 4) |
13efbfc53054
patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24659
diff
changeset
|
2077 call assert_equal([4], m) |
13efbfc53054
patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24659
diff
changeset
|
2078 extend(m, [6], 0) |
13efbfc53054
patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24659
diff
changeset
|
2079 call assert_equal([6, 4], m) |
13efbfc53054
patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24659
diff
changeset
|
2080 |
24484
bc1a533148d7
patch 8.2.2782: Vim9: blob operations not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24482
diff
changeset
|
2081 var lines =<< trim END |
bc1a533148d7
patch 8.2.2782: Vim9: blob operations not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24482
diff
changeset
|
2082 insert(test_null_list(), 123) |
bc1a533148d7
patch 8.2.2782: Vim9: blob operations not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24482
diff
changeset
|
2083 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2084 v9.CheckDefExecAndScriptFailure(lines, 'E1130:', 1) |
24484
bc1a533148d7
patch 8.2.2782: Vim9: blob operations not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24482
diff
changeset
|
2085 |
bc1a533148d7
patch 8.2.2782: Vim9: blob operations not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24482
diff
changeset
|
2086 lines =<< trim END |
bc1a533148d7
patch 8.2.2782: Vim9: blob operations not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24482
diff
changeset
|
2087 insert(test_null_blob(), 123) |
bc1a533148d7
patch 8.2.2782: Vim9: blob operations not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24482
diff
changeset
|
2088 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2089 v9.CheckDefExecAndScriptFailure(lines, 'E1131:', 1) |
24484
bc1a533148d7
patch 8.2.2782: Vim9: blob operations not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24482
diff
changeset
|
2090 |
22661
c6b17787a38f
patch 8.2.1879: Vim9: argument types of insert() not checked when compiling
Bram Moolenaar <Bram@vim.org>
parents:
22655
diff
changeset
|
2091 assert_equal([1, 2, 3], insert([2, 3], 1)) |
27669
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27573
diff
changeset
|
2092 assert_equal([1, 2, 3], insert([2, 3], number_one)) |
22661
c6b17787a38f
patch 8.2.1879: Vim9: argument types of insert() not checked when compiling
Bram Moolenaar <Bram@vim.org>
parents:
22655
diff
changeset
|
2093 assert_equal([1, 2, 3], insert([1, 2], 3, 2)) |
27669
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27573
diff
changeset
|
2094 assert_equal([1, 2, 3], insert([1, 2], 3, number_two)) |
22661
c6b17787a38f
patch 8.2.1879: Vim9: argument types of insert() not checked when compiling
Bram Moolenaar <Bram@vim.org>
parents:
22655
diff
changeset
|
2095 assert_equal(['a', 'b', 'c'], insert(['b', 'c'], 'a')) |
c6b17787a38f
patch 8.2.1879: Vim9: argument types of insert() not checked when compiling
Bram Moolenaar <Bram@vim.org>
parents:
22655
diff
changeset
|
2096 assert_equal(0z1234, insert(0z34, 0x12)) |
22898
a8bccb0634bc
patch 8.2.1996: Vim9: invalid error for argument of extend()
Bram Moolenaar <Bram@vim.org>
parents:
22766
diff
changeset
|
2097 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2098 v9.CheckDefAndScriptFailure(['insert("a", 1)'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1226: List or Blob required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2099 v9.CheckDefFailure(['insert([2, 3], "a")'], 'E1013: Argument 2: type mismatch, expected number but got string') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2100 v9.CheckDefAndScriptFailure(['insert([2, 3], 1, "x")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2101 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2102 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2103 def Test_invert() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2104 v9.CheckDefAndScriptFailure(['invert("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2105 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2106 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2107 def Test_isdirectory() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2108 v9.CheckDefAndScriptFailure(['isdirectory(1.1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2109 assert_false(isdirectory('NonExistingDir')) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2110 assert_false(isdirectory('')) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2111 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2112 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2113 def Test_islocked() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2114 v9.CheckDefAndScriptFailure(['islocked(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2115 v9.CheckDefAndScriptFailure(['var n1: number = 10', 'islocked(n1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2116 g:v1 = 10 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2117 assert_false(islocked('g:v1')) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2118 lockvar g:v1 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2119 assert_true(islocked('g:v1')) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2120 unlet g:v1 |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2121 islocked('')->assert_equal(-1) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2122 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2123 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2124 def Test_items() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2125 v9.CheckDefFailure(['[]->items()'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2126 assert_equal([['a', 10], ['b', 20]], {'a': 10, 'b': 20}->items()) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2127 assert_equal([], {}->items()) |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
2128 assert_equal(['x', 'x'], {'a': 10, 'b': 20}->items()->map((_, _) => 'x')) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2129 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2130 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2131 def Test_job_getchannel() |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2132 if !has('job') |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2133 CheckFeature job |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2134 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2135 v9.CheckDefAndScriptFailure(['job_getchannel("a")'], ['E1013: Argument 1: type mismatch, expected job but got string', 'E1218: Job required for argument 1']) |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2136 assert_fails('job_getchannel(test_null_job())', 'E916: not a valid job') |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2137 endif |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2138 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2139 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2140 def Test_job_info() |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2141 if !has('job') |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2142 CheckFeature job |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2143 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2144 v9.CheckDefAndScriptFailure(['job_info("a")'], ['E1013: Argument 1: type mismatch, expected job but got string', 'E1218: Job required for argument 1']) |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2145 assert_fails('job_info(test_null_job())', 'E916: not a valid job') |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2146 endif |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2147 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2148 |
26368
744fdb15347d
patch 8.2.3715: Vim9: valgrind reports spurious problems for a test
Bram Moolenaar <Bram@vim.org>
parents:
26230
diff
changeset
|
2149 " Test_job_info_return_type() is in test_vim9_fails.vim |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2150 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2151 def Test_job_setoptions() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2152 if !has('job') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2153 CheckFeature job |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2154 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2155 v9.CheckDefAndScriptFailure(['job_setoptions(test_null_channel(), {})'], ['E1013: Argument 1: type mismatch, expected job but got channel', 'E1218: Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2156 v9.CheckDefAndScriptFailure(['job_setoptions(test_null_job(), [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2157 assert_equal('fail', job_status(test_null_job())) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2158 endif |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2159 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2160 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2161 def Test_job_status() |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2162 if !has('job') |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2163 CheckFeature job |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2164 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2165 v9.CheckDefAndScriptFailure(['job_status("a")'], ['E1013: Argument 1: type mismatch, expected job but got string', 'E1218: Job required for argument 1']) |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2166 assert_equal('fail', job_status(test_null_job())) |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2167 endif |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2168 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2169 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2170 def Test_job_stop() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2171 if !has('job') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2172 CheckFeature job |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2173 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2174 v9.CheckDefAndScriptFailure(['job_stop("a")'], ['E1013: Argument 1: type mismatch, expected job but got string', 'E1218: Job required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2175 v9.CheckDefAndScriptFailure(['job_stop(test_null_job(), true)'], ['E1013: Argument 2: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 2']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2176 endif |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2177 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2178 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2179 def Test_join() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2180 v9.CheckDefAndScriptFailure(['join("abc")'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2181 v9.CheckDefAndScriptFailure(['join([], 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2182 join([''], '')->assert_equal('') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2183 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2184 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2185 def Test_js_decode() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2186 v9.CheckDefAndScriptFailure(['js_decode(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2187 assert_equal([1, 2], js_decode('[1,2]')) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2188 js_decode('')->assert_equal(v:none) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2189 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2190 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2191 def Test_json_decode() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2192 v9.CheckDefAndScriptFailure(['json_decode(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2193 assert_equal(1.0, json_decode('1.0')) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2194 json_decode('')->assert_equal(v:none) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2195 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2196 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2197 def Test_keys() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
2198 assert_equal([7, 7], keys({a: 1, b: 2})->map((_, _) => 7)) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
2199 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2200 v9.CheckDefAndScriptFailure(['keys([])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2201 assert_equal(['a'], {a: 'v'}->keys()) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2202 assert_equal([], {}->keys()) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2203 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2204 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2205 def Test_keys_return_type() |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2206 const var: list<string> = {a: 1, b: 2}->keys() |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2207 var->assert_equal(['a', 'b']) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2208 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2209 |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2210 def Test_len() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2211 v9.CheckDefAndScriptFailure(['len(true)'], ['E1013: Argument 1: type mismatch, expected list<any> but got bool', 'E701: Invalid type for len()']) |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2212 assert_equal(2, "ab"->len()) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2213 assert_equal(3, 456->len()) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2214 assert_equal(0, []->len()) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2215 assert_equal(1, {a: 10}->len()) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2216 assert_equal(4, 0z20304050->len()) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2217 enddef |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2218 |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2219 def Test_libcall() |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2220 CheckFeature libcall |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2221 v9.CheckDefAndScriptFailure(['libcall(1, "b", 3)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2222 v9.CheckDefAndScriptFailure(['libcall("a", 2, 3)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2223 v9.CheckDefAndScriptFailure(['libcall("a", "b", 1.1)'], ['E1013: Argument 3: type mismatch, expected string but got float', 'E1220: String or Number required for argument 3']) |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2224 enddef |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2225 |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2226 def Test_libcallnr() |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2227 CheckFeature libcall |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2228 v9.CheckDefAndScriptFailure(['libcallnr(1, "b", 3)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2229 v9.CheckDefAndScriptFailure(['libcallnr("a", 2, 3)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2230 v9.CheckDefAndScriptFailure(['libcallnr("a", "b", 1.1)'], ['E1013: Argument 3: type mismatch, expected string but got float', 'E1220: String or Number required for argument 3']) |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2231 enddef |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2232 |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
2233 def Test_line() |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2234 assert_fails('line(true)', 'E1174:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2235 v9.CheckDefAndScriptFailure(['line(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2236 v9.CheckDefAndScriptFailure(['line(".", "a")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2237 v9.CheckDefExecAndScriptFailure(['line("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2238 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2239 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2240 def Test_line2byte() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2241 v9.CheckDefAndScriptFailure(['line2byte(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2242 v9.CheckDefExecAndScriptFailure(['line2byte("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2243 assert_equal(-1, line2byte(1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2244 assert_equal(-1, line2byte(10000)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2245 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2246 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2247 def Test_lispindent() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2248 v9.CheckDefAndScriptFailure(['lispindent({})'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2249 v9.CheckDefExecAndScriptFailure(['lispindent("")'], 'E1209: Invalid value for a line number') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2250 v9.CheckDefExecAndScriptFailure(['lispindent(-1)'], 'E966: Invalid line number: -1') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2251 assert_equal(0, lispindent(1)) |
24250
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
2252 enddef |
01b274c3f69b
patch 8.2.2666: Vim9: not enough function arguments checked for string
Bram Moolenaar <Bram@vim.org>
parents:
24248
diff
changeset
|
2253 |
25806
8d55e978f95b
patch 8.2.3438: cannot manipulate blobs
Bram Moolenaar <Bram@vim.org>
parents:
25784
diff
changeset
|
2254 def Test_list2blob() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2255 v9.CheckDefAndScriptFailure(['list2blob(10)'], ['E1013: Argument 1: type mismatch, expected list<number> but got number', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2256 v9.CheckDefFailure(['list2blob([0z10, 0z02])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<blob>') |
25806
8d55e978f95b
patch 8.2.3438: cannot manipulate blobs
Bram Moolenaar <Bram@vim.org>
parents:
25784
diff
changeset
|
2257 enddef |
8d55e978f95b
patch 8.2.3438: cannot manipulate blobs
Bram Moolenaar <Bram@vim.org>
parents:
25784
diff
changeset
|
2258 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2259 def Test_list2str_str2list_utf8() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2260 var s = "\u3042\u3044" |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2261 var l = [0x3042, 0x3044] |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2262 str2list(s, true)->assert_equal(l) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2263 list2str(l, true)->assert_equal(s) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2264 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2265 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2266 def Test_list2str() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2267 v9.CheckDefAndScriptFailure(['list2str(".", true)'], ['E1013: Argument 1: type mismatch, expected list<number> but got string', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2268 v9.CheckDefAndScriptFailure(['list2str([1], 0z10)'], ['E1013: Argument 2: type mismatch, expected bool but got blob', 'E1212: Bool required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2269 enddef |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2270 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2271 def s:SID(): number |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2272 return expand('<SID>') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2273 ->matchstr('<SNR>\zs\d\+\ze_$') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2274 ->str2nr() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2275 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2276 |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2277 def Test_listener_add() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2278 v9.CheckDefAndScriptFailure(['listener_add("1", true)'], ['E1013: Argument 2: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 2']) |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2279 enddef |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
2280 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2281 def Test_listener_flush() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2282 v9.CheckDefAndScriptFailure(['listener_flush([1])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2283 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2284 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2285 def Test_listener_remove() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2286 v9.CheckDefAndScriptFailure(['listener_remove("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2287 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2288 |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2289 def Test_luaeval() |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2290 if !has('lua') |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2291 CheckFeature lua |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2292 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2293 v9.CheckDefAndScriptFailure(['luaeval(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2294 if exists_compiled('*luaeval') |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2295 luaeval('')->assert_equal(v:null) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2296 endif |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2297 enddef |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2298 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2299 def Test_map() |
26632
501b1a24d032
patch 8.2.3845: Vim9: test fails when the channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
26585
diff
changeset
|
2300 if has('channel') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2301 v9.CheckDefAndScriptFailure(['map(test_null_channel(), "1")'], ['E1013: Argument 1: type mismatch, expected list<any> but got channel', 'E1251: List, Dictionary, Blob or String required for argument 1']) |
26632
501b1a24d032
patch 8.2.3845: Vim9: test fails when the channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
26585
diff
changeset
|
2302 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2303 v9.CheckDefAndScriptFailure(['map(1, "1")'], ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1251: List, Dictionary, Blob or String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2304 v9.CheckDefAndScriptFailure(['map([1, 2], 4)'], ['E1256: String or function required for argument 2', 'E1024: Using a Number as a String']) |
26925
4e77f9961650
patch 8.2.3991: Vim9: error when extending dict<any>
Bram Moolenaar <Bram@vim.org>
parents:
26907
diff
changeset
|
2305 |
4e77f9961650
patch 8.2.3991: Vim9: error when extending dict<any>
Bram Moolenaar <Bram@vim.org>
parents:
26907
diff
changeset
|
2306 # type of dict remains dict<any> even when type of values changes |
26937
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2307 # same for list |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2308 var lines =<< trim END |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2309 var d: dict<any> = {a: 0} |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2310 d->map((k, v) => true) |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2311 d->map((k, v) => 'x') |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2312 assert_equal({a: 'x'}, d) |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2313 |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2314 d = {a: 0} |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2315 g:gd = d |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2316 map(g:gd, (k, v) => true) |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2317 assert_equal({a: true}, g:gd) |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2318 |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2319 var l: list<any> = [0] |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2320 l->map((k, v) => true) |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2321 l->map((k, v) => 'x') |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2322 assert_equal(['x'], l) |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2323 |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2324 l = [1] |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2325 g:gl = l |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2326 map(g:gl, (k, v) => true) |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2327 assert_equal([true], g:gl) |
27567
5bf2fca4f967
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Bram Moolenaar <Bram@vim.org>
parents:
27555
diff
changeset
|
2328 |
5bf2fca4f967
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Bram Moolenaar <Bram@vim.org>
parents:
27555
diff
changeset
|
2329 assert_equal(['x'], [[1, 2]]->map((_, v) => 'x')) |
5bf2fca4f967
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Bram Moolenaar <Bram@vim.org>
parents:
27555
diff
changeset
|
2330 assert_equal(['x'], [{a: 0}]->map((_, v) => 'x')) |
5bf2fca4f967
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Bram Moolenaar <Bram@vim.org>
parents:
27555
diff
changeset
|
2331 assert_equal({a: 'x'}, {a: [1, 2]}->map((_, v) => 'x')) |
5bf2fca4f967
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Bram Moolenaar <Bram@vim.org>
parents:
27555
diff
changeset
|
2332 assert_equal({a: 'x'}, {a: {b: 2}}->map((_, v) => 'x')) |
26937
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2333 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2334 v9.CheckDefAndScriptSuccess(lines) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2335 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2336 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2337 def Test_map_failure() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2338 CheckFeature job |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2339 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2340 var lines =<< trim END |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2341 vim9script |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2342 writefile([], 'Xtmpfile') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2343 silent e Xtmpfile |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2344 var d = {[bufnr('%')]: {a: 0}} |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2345 au BufReadPost * Func() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2346 def Func() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2347 if d->has_key('') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2348 endif |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2349 eval d[expand('<abuf>')]->mapnew((_, v: dict<job>) => 0) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2350 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2351 e |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2352 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2353 v9.CheckScriptFailure(lines, 'E1013:') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2354 au! BufReadPost |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2355 delete('Xtmpfile') |
26937
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2356 |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2357 lines =<< trim END |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2358 var d: dict<number> = {a: 1} |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2359 g:gd = d |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2360 map(g:gd, (k, v) => true) |
7045e9308ca3
patch 8.2.3997: Vim9: not enough testing for extend() and map()
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
2361 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2362 v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected number but got bool') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2363 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2364 |
23646
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2365 def Test_map_function_arg() |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2366 var lines =<< trim END |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2367 def MapOne(i: number, v: string): string |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2368 return i .. ':' .. v |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2369 enddef |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2370 var l = ['a', 'b', 'c'] |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2371 map(l, MapOne) |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2372 assert_equal(['0:a', '1:b', '2:c'], l) |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2373 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2374 v9.CheckDefAndScriptSuccess(lines) |
24808
0bc60e26a2b5
patch 8.2.2942: Vim9: error when calling function with too few arguments
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
2375 |
0bc60e26a2b5
patch 8.2.2942: Vim9: error when calling function with too few arguments
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
2376 lines =<< trim END |
0bc60e26a2b5
patch 8.2.2942: Vim9: error when calling function with too few arguments
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
2377 range(3)->map((a, b, c) => a + b + c) |
0bc60e26a2b5
patch 8.2.2942: Vim9: error when calling function with too few arguments
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
2378 END |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2379 v9.CheckDefAndScriptFailure(lines, ['E176:', 'E1190: One argument too few']) |
24808
0bc60e26a2b5
patch 8.2.2942: Vim9: error when calling function with too few arguments
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
2380 lines =<< trim END |
0bc60e26a2b5
patch 8.2.2942: Vim9: error when calling function with too few arguments
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
2381 range(3)->map((a, b, c, d) => a + b + c + d) |
0bc60e26a2b5
patch 8.2.2942: Vim9: error when calling function with too few arguments
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
2382 END |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2383 v9.CheckDefAndScriptFailure(lines, ['E176:', 'E1190: 2 arguments too few']) |
26737
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
2384 |
27406
4c1bdee75bed
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Bram Moolenaar <Bram@vim.org>
parents:
27402
diff
changeset
|
2385 # declared list cannot change type |
26737
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
2386 lines =<< trim END |
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
2387 def Map(i: number, v: number): string |
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
2388 return 'bad' |
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
2389 enddef |
27406
4c1bdee75bed
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Bram Moolenaar <Bram@vim.org>
parents:
27402
diff
changeset
|
2390 var ll: list<number> = [1, 2, 3] |
4c1bdee75bed
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Bram Moolenaar <Bram@vim.org>
parents:
27402
diff
changeset
|
2391 echo map(ll, Map) |
26737
10d3105030ab
patch 8.2.3897: Vim9: second argument of map() and filter() not checked
Bram Moolenaar <Bram@vim.org>
parents:
26733
diff
changeset
|
2392 END |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2393 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?number): number but got func(number, number): string', 'E1012: Type mismatch; expected number but got string in map()']) |
27406
4c1bdee75bed
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Bram Moolenaar <Bram@vim.org>
parents:
27402
diff
changeset
|
2394 |
4c1bdee75bed
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Bram Moolenaar <Bram@vim.org>
parents:
27402
diff
changeset
|
2395 # not declared list can change type |
4c1bdee75bed
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Bram Moolenaar <Bram@vim.org>
parents:
27402
diff
changeset
|
2396 echo [1, 2, 3]->map((..._) => 'x') |
23646
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2397 enddef |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2398 |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2399 def Test_map_item_type() |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2400 var lines =<< trim END |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2401 var l = ['a', 'b', 'c'] |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2402 map(l, (k, v) => k .. '/' .. v ) |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2403 assert_equal(['0/a', '1/b', '2/c'], l) |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2404 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2405 v9.CheckDefAndScriptSuccess(lines) |
23646
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2406 |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2407 lines =<< trim END |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2408 var l: list<number> = [0] |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2409 echo map(l, (_, v) => []) |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2410 END |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2411 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?number): number but got func(any, any): list<unknown>', 'E1012: Type mismatch; expected number but got list<unknown> in map()'], 2) |
23646
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2412 |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2413 lines =<< trim END |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2414 var l: list<number> = range(2) |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2415 echo map(l, (_, v) => []) |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2416 END |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2417 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?number): number but got func(any, any): list<unknown>', 'E1012: Type mismatch; expected number but got list<unknown> in map()'], 2) |
23646
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2418 |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2419 lines =<< trim END |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2420 var d: dict<number> = {key: 0} |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2421 echo map(d, (_, v) => []) |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2422 END |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2423 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?string, ?number): number but got func(any, any): list<unknown>', 'E1012: Type mismatch; expected number but got list<unknown> in map()'], 2) |
23646
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2424 enddef |
5d77a7587927
patch 8.2.2365: Vim9: no check for map() changing item type at script level
Bram Moolenaar <Bram@vim.org>
parents:
23640
diff
changeset
|
2425 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2426 def Test_maparg() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2427 var lnum = str2nr(expand('<sflnum>')) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2428 map foo bar |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2429 maparg('foo', '', false, true)->assert_equal({ |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2430 lnum: lnum + 1, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2431 script: 0, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2432 mode: ' ', |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2433 silent: 0, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2434 noremap: 0, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2435 lhs: 'foo', |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2436 lhsraw: 'foo', |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2437 nowait: 0, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2438 expr: 0, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2439 sid: SID(), |
27225
95f202f77cbb
patch 8.2.4141: Vim9 builtin functions test fails
Bram Moolenaar <Bram@vim.org>
parents:
26937
diff
changeset
|
2440 scriptversion: 999999, |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2441 rhs: 'bar', |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2442 buffer: 0}) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2443 unmap foo |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2444 v9.CheckDefAndScriptFailure(['maparg(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2445 v9.CheckDefAndScriptFailure(['maparg("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2446 v9.CheckDefAndScriptFailure(['maparg("a", "b", 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2447 v9.CheckDefAndScriptFailure(['maparg("a", "b", true, 2)'], ['E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2448 maparg('')->assert_equal('') |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2449 |
27800
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2450 # value argument type is checked at compile time |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2451 var lines =<< trim END |
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2452 var l = [123] |
27800
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2453 l->map((i: number, v: string) => 0) |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2454 END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2455 v9.CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected func(?number, ?number): number but got func(number, string): number') |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2456 |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2457 lines =<< trim END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2458 var d = {a: 123} |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2459 d->map((i: string, v: string) => 0) |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2460 END |
27800
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2461 v9.CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected func(?string, ?number): number but got func(string, string): number') |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2462 |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2463 lines =<< trim END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2464 var s = 'abc' |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2465 s->map((i: number, v: number) => 'x') |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2466 END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2467 v9.CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected func(?number, ?string): string but got func(number, number): string') |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2468 |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2469 lines =<< trim END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2470 var s = 0z1122 |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2471 s->map((i: number, v: string) => 0) |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2472 END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2473 v9.CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected func(?number, ?number): number but got func(number, string): number') |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2474 |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2475 # index argument type is checked at compile time |
27798
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2476 lines =<< trim END |
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2477 ['x']->map((i: string, v: string) => 'y') |
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2478 END |
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2479 v9.CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected func(?number, ?any): any but got func(string, string): string') |
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2480 |
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2481 lines =<< trim END |
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2482 {a: 1}->map((i: number, v: number) => 0) |
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2483 END |
324d394e314e
patch 8.2.4425: map() function does not check function arguments
Bram Moolenaar <Bram@vim.org>
parents:
27728
diff
changeset
|
2484 v9.CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected func(?string, ?any): any but got func(number, number): number') |
27800
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2485 |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2486 lines =<< trim END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2487 'abc'->map((i: string, v: string) => 'x') |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2488 END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2489 v9.CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected func(?number, ?string): string but got func(string, string): string') |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2490 |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2491 lines =<< trim END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2492 0z1122->map((i: string, v: number) => 0) |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2493 END |
6e5d378919c4
patch 8.2.4426: map() function on string and blob does not check types
Bram Moolenaar <Bram@vim.org>
parents:
27798
diff
changeset
|
2494 v9.CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected func(?number, ?number): number but got func(string, number): number') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2495 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2496 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2497 def Test_maparg_mapset() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2498 nnoremap <F3> :echo "hit F3"<CR> |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2499 var mapsave = maparg('<F3>', 'n', false, true) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2500 mapset('n', false, mapsave) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2501 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2502 nunmap <F3> |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2503 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2504 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2505 def Test_mapcheck() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2506 iabbrev foo foobar |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2507 mapcheck('foo', 'i', true)->assert_equal('foobar') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2508 iunabbrev foo |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2509 v9.CheckDefAndScriptFailure(['mapcheck(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2510 v9.CheckDefAndScriptFailure(['mapcheck("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2511 v9.CheckDefAndScriptFailure(['mapcheck("a", "b", 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2512 mapcheck('')->assert_equal('') |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2513 mapcheck('', '')->assert_equal('') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2514 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2515 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2516 def Test_mapnew() |
26632
501b1a24d032
patch 8.2.3845: Vim9: test fails when the channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
26585
diff
changeset
|
2517 if has('channel') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2518 v9.CheckDefAndScriptFailure(['mapnew(test_null_job(), "1")'], ['E1013: Argument 1: type mismatch, expected list<any> but got job', 'E1251: List, Dictionary, Blob or String required for argument 1']) |
26632
501b1a24d032
patch 8.2.3845: Vim9: test fails when the channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
26585
diff
changeset
|
2519 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2520 v9.CheckDefAndScriptFailure(['mapnew(1, "1")'], ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1251: List, Dictionary, Blob or String required for argument 1']) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2521 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2522 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2523 def Test_mapset() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2524 v9.CheckDefAndScriptFailure(['mapset(1, true, {})'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2525 v9.CheckDefAndScriptFailure(['mapset("a", 2, {})'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2526 v9.CheckDefAndScriptFailure(['mapset("a", false, [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
23990
06da0685077b
patch 8.2.2537: Vim9: crash when map() fails
Bram Moolenaar <Bram@vim.org>
parents:
23909
diff
changeset
|
2527 enddef |
06da0685077b
patch 8.2.2537: Vim9: crash when map() fails
Bram Moolenaar <Bram@vim.org>
parents:
23909
diff
changeset
|
2528 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2529 def Test_match() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2530 v9.CheckDefAndScriptFailure(['match(0z12, "p")'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2531 v9.CheckDefAndScriptFailure(['match(["s"], [2])'], ['E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2532 v9.CheckDefAndScriptFailure(['match("s", "p", "q")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2533 v9.CheckDefAndScriptFailure(['match("s", "p", 1, "r")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2534 assert_equal(2, match('ab12cd', '12')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2535 assert_equal(-1, match('ab12cd', '34')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2536 assert_equal(6, match('ab12cd12ef', '12', 4)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2537 assert_equal(2, match('abcd', '..', 0, 3)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2538 assert_equal(1, match(['a', 'b', 'c'], 'b')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2539 assert_equal(-1, match(['a', 'b', 'c'], 'd')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2540 assert_equal(3, match(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2541 assert_equal(5, match(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2, 2)) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2542 match('', 'a')->assert_equal(-1) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2543 match('abc', '')->assert_equal(0) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2544 match('', '')->assert_equal(0) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2545 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2546 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2547 def Test_matchadd() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2548 v9.CheckDefAndScriptFailure(['matchadd(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2549 v9.CheckDefAndScriptFailure(['matchadd("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2550 v9.CheckDefAndScriptFailure(['matchadd("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2551 v9.CheckDefAndScriptFailure(['matchadd("a", "b", 1, "d")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2552 v9.CheckDefAndScriptFailure(['matchadd("a", "b", 1, 1, [])'], ['E1013: Argument 5: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 5']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
2553 matchadd('', 'a')->assert_equal(-1) |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
2554 matchadd('Search', '')->assert_equal(-1) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2555 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2556 |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2557 def Test_matchaddpos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2558 v9.CheckDefAndScriptFailure(['matchaddpos(1, [1])'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2559 v9.CheckDefAndScriptFailure(['matchaddpos("a", "b")'], ['E1013: Argument 2: type mismatch, expected list<any> but got string', 'E1211: List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2560 v9.CheckDefAndScriptFailure(['matchaddpos("a", [1], "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2561 v9.CheckDefAndScriptFailure(['matchaddpos("a", [1], 1, "d")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2562 v9.CheckDefAndScriptFailure(['matchaddpos("a", [1], 1, 1, [])'], ['E1013: Argument 5: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 5']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
2563 matchaddpos('', [1])->assert_equal(-1) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2564 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2565 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2566 def Test_matcharg() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2567 v9.CheckDefAndScriptFailure(['matcharg("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2568 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2569 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2570 def Test_matchdelete() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2571 v9.CheckDefAndScriptFailure(['matchdelete("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2572 v9.CheckDefAndScriptFailure(['matchdelete("x", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2573 v9.CheckDefAndScriptFailure(['matchdelete(1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2574 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2575 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2576 def Test_matchend() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2577 v9.CheckDefAndScriptFailure(['matchend(0z12, "p")'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2578 v9.CheckDefAndScriptFailure(['matchend(["s"], [2])'], ['E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2579 v9.CheckDefAndScriptFailure(['matchend("s", "p", "q")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2580 v9.CheckDefAndScriptFailure(['matchend("s", "p", 1, "r")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2581 assert_equal(4, matchend('ab12cd', '12')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2582 assert_equal(-1, matchend('ab12cd', '34')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2583 assert_equal(8, matchend('ab12cd12ef', '12', 4)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2584 assert_equal(4, matchend('abcd', '..', 0, 3)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2585 assert_equal(1, matchend(['a', 'b', 'c'], 'b')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2586 assert_equal(-1, matchend(['a', 'b', 'c'], 'd')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2587 assert_equal(3, matchend(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2588 assert_equal(5, matchend(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2, 2)) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2589 matchend('', 'a')->assert_equal(-1) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2590 matchend('abc', '')->assert_equal(0) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2591 matchend('', '')->assert_equal(0) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2592 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2593 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2594 def Test_matchfuzzy() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2595 v9.CheckDefAndScriptFailure(['matchfuzzy({}, "p")'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<unknown>', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2596 v9.CheckDefAndScriptFailure(['matchfuzzy([], 1)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2597 v9.CheckDefAndScriptFailure(['matchfuzzy([], "a", [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2598 matchfuzzy(['abc', 'xyz'], '')->assert_equal([]) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2599 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2600 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2601 def Test_matchfuzzypos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2602 v9.CheckDefAndScriptFailure(['matchfuzzypos({}, "p")'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<unknown>', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2603 v9.CheckDefAndScriptFailure(['matchfuzzypos([], 1)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2604 v9.CheckDefAndScriptFailure(['matchfuzzypos([], "a", [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2605 matchfuzzypos(['abc', 'xyz'], '')->assert_equal([[], [], []]) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2606 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2607 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2608 def Test_matchlist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2609 v9.CheckDefAndScriptFailure(['matchlist(0z12, "p")'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2610 v9.CheckDefAndScriptFailure(['matchlist(["s"], [2])'], ['E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2611 v9.CheckDefAndScriptFailure(['matchlist("s", "p", "q")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2612 v9.CheckDefAndScriptFailure(['matchlist("s", "p", 1, "r")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2613 var l: list<string> = ['12', '', '', '', '', '', '', '', '', ''] |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2614 assert_equal(l, matchlist('ab12cd', '12')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2615 assert_equal([], matchlist('ab12cd', '34')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2616 assert_equal(l, matchlist('ab12cd12ef', '12', 4)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2617 l[0] = 'cd' |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2618 assert_equal(l, matchlist('abcd', '..', 0, 3)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2619 l[0] = 'b' |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2620 assert_equal(l, matchlist(['a', 'b', 'c'], 'b')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2621 assert_equal([], matchlist(['a', 'b', 'c'], 'd')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2622 assert_equal(l, matchlist(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2623 assert_equal(l, matchlist(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2, 2)) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2624 matchlist('', 'a')->assert_equal([]) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2625 matchlist('abc', '')->assert_equal(repeat([''], 10)) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2626 matchlist('', '')->assert_equal(repeat([''], 10)) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2627 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2628 |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2629 def Test_matchstr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2630 v9.CheckDefAndScriptFailure(['matchstr(0z12, "p")'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2631 v9.CheckDefAndScriptFailure(['matchstr(["s"], [2])'], ['E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2632 v9.CheckDefAndScriptFailure(['matchstr("s", "p", "q")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2633 v9.CheckDefAndScriptFailure(['matchstr("s", "p", 1, "r")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2634 assert_equal('12', matchstr('ab12cd', '12')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2635 assert_equal('', matchstr('ab12cd', '34')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2636 assert_equal('12', matchstr('ab12cd12ef', '12', 4)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2637 assert_equal('cd', matchstr('abcd', '..', 0, 3)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2638 assert_equal('b', matchstr(['a', 'b', 'c'], 'b')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2639 assert_equal('', matchstr(['a', 'b', 'c'], 'd')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2640 assert_equal('b', matchstr(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2641 assert_equal('b', matchstr(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2, 2)) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2642 matchstr('', 'a')->assert_equal('') |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2643 matchstr('abc', '')->assert_equal('') |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2644 matchstr('', '')->assert_equal('') |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2645 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2646 |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2647 def Test_matchstrpos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2648 v9.CheckDefAndScriptFailure(['matchstrpos(0z12, "p")'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2649 v9.CheckDefAndScriptFailure(['matchstrpos(["s"], [2])'], ['E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2650 v9.CheckDefAndScriptFailure(['matchstrpos("s", "p", "q")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2651 v9.CheckDefAndScriptFailure(['matchstrpos("s", "p", 1, "r")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2652 assert_equal(['12', 2, 4], matchstrpos('ab12cd', '12')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2653 assert_equal(['', -1, -1], matchstrpos('ab12cd', '34')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2654 assert_equal(['12', 6, 8], matchstrpos('ab12cd12ef', '12', 4)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2655 assert_equal(['cd', 2, 4], matchstrpos('abcd', '..', 0, 3)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2656 assert_equal(['b', 1, 0, 1], matchstrpos(['a', 'b', 'c'], 'b')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2657 assert_equal(['', -1, -1, -1], matchstrpos(['a', 'b', 'c'], 'd')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2658 assert_equal(['b', 3, 0, 1], |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2659 matchstrpos(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2660 assert_equal(['b', 5, 0, 1], |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2661 matchstrpos(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2, 2)) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2662 matchstrpos('', 'a')->assert_equal(['', -1, -1]) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2663 matchstrpos('abc', '')->assert_equal(['', 0, 0]) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2664 matchstrpos('', '')->assert_equal(['', 0, 0]) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2665 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2666 |
23705
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2667 def Test_max() |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2668 g:flag = true |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2669 var l1: list<number> = g:flag |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2670 ? [1, max([2, 3])] |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2671 : [4, 5] |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2672 assert_equal([1, 3], l1) |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2673 |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2674 g:flag = false |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2675 var l2: list<number> = g:flag |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2676 ? [1, max([2, 3])] |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2677 : [4, 5] |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2678 assert_equal([4, 5], l2) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2679 v9.CheckDefAndScriptFailure(['max(5)'], ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1227: List or Dictionary required for argument 1']) |
23705
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2680 enddef |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2681 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2682 def Test_menu_info() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2683 v9.CheckDefAndScriptFailure(['menu_info(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2684 v9.CheckDefAndScriptFailure(['menu_info(10, "n")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2685 v9.CheckDefAndScriptFailure(['menu_info("File", 10)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2686 assert_equal({}, menu_info('aMenu')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2687 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2688 |
23705
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2689 def Test_min() |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2690 g:flag = true |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2691 var l1: list<number> = g:flag |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2692 ? [1, min([2, 3])] |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2693 : [4, 5] |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2694 assert_equal([1, 2], l1) |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2695 |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2696 g:flag = false |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2697 var l2: list<number> = g:flag |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2698 ? [1, min([2, 3])] |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2699 : [4, 5] |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2700 assert_equal([4, 5], l2) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2701 v9.CheckDefAndScriptFailure(['min(5)'], ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1227: List or Dictionary required for argument 1']) |
23705
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2702 enddef |
9092d2a4422a
patch 8.2.2394: Vim9: min() and max() return type is "any"
Bram Moolenaar <Bram@vim.org>
parents:
23691
diff
changeset
|
2703 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2704 def Test_mkdir() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2705 v9.CheckDefAndScriptFailure(['mkdir(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2706 v9.CheckDefAndScriptFailure(['mkdir("a", {})'], ['E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2707 v9.CheckDefAndScriptFailure(['mkdir("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2708 v9.CheckDefExecAndScriptFailure(['mkdir("")'], 'E1175: Non-empty string required for argument 1') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2709 delete('a', 'rf') |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2710 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2711 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2712 def Test_mode() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2713 v9.CheckDefAndScriptFailure(['mode("1")'], ['E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2714 v9.CheckDefAndScriptFailure(['mode(2)'], ['E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2715 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2716 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2717 def Test_mzeval() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2718 if !has('mzscheme') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2719 CheckFeature mzscheme |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2720 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2721 v9.CheckDefAndScriptFailure(['mzeval(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2722 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2723 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2724 def Test_nextnonblank() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2725 v9.CheckDefAndScriptFailure(['nextnonblank(null)'], ['E1013: Argument 1: type mismatch, expected string but got special', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2726 v9.CheckDefExecAndScriptFailure(['nextnonblank("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2727 assert_equal(0, nextnonblank(1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2728 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2729 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2730 def Test_nr2char() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2731 nr2char(97, true)->assert_equal('a') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2732 v9.CheckDefAndScriptFailure(['nr2char("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2733 v9.CheckDefAndScriptFailure(['nr2char(1, "a")'], ['E1013: Argument 2: type mismatch, expected bool but got string', 'E1212: Bool required for argument 2']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2734 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2735 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2736 def Test_or() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2737 v9.CheckDefAndScriptFailure(['or("x", 0x2)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2738 v9.CheckDefAndScriptFailure(['or(0x1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2739 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2740 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2741 def Test_pathshorten() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2742 v9.CheckDefAndScriptFailure(['pathshorten(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2743 v9.CheckDefAndScriptFailure(['pathshorten("a", "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
2744 pathshorten('')->assert_equal('') |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2745 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2746 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2747 def Test_perleval() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2748 if !has('perl') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2749 CheckFeature perl |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2750 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2751 v9.CheckDefAndScriptFailure(['perleval(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2752 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2753 |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2754 def Test_popup_atcursor() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2755 v9.CheckDefAndScriptFailure(['popup_atcursor({"a": 10}, {})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String, Number or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2756 v9.CheckDefAndScriptFailure(['popup_atcursor("a", [1, 2])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2']) |
25236
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2757 |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2758 # Pass variable of type 'any' to popup_atcursor() |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2759 var what: any = 'Hello' |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2760 var popupID = what->popup_atcursor({moved: 'any'}) |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2761 assert_equal(0, popupID->popup_getoptions().tabpage) |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2762 popupID->popup_close() |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2763 enddef |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2764 |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2765 def Test_popup_beval() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2766 v9.CheckDefAndScriptFailure(['popup_beval({"a": 10}, {})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String, Number or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2767 v9.CheckDefAndScriptFailure(['popup_beval("a", [1, 2])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2']) |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2768 enddef |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2769 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2770 def Test_popup_clear() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2771 v9.CheckDefAndScriptFailure(['popup_clear(["a"])'], ['E1013: Argument 1: type mismatch, expected bool but got list<string>', 'E1212: Bool required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2772 v9.CheckDefAndScriptFailure(['popup_clear(2)'], ['E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2773 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2774 |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2775 def Test_popup_close() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2776 v9.CheckDefAndScriptFailure(['popup_close("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2777 enddef |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2778 |
25236
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2779 def Test_popup_create() |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2780 # Pass variable of type 'any' to popup_create() |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2781 var what: any = 'Hello' |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2782 var popupID = what->popup_create({}) |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2783 assert_equal(0, popupID->popup_getoptions().tabpage) |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2784 popupID->popup_close() |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2785 enddef |
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
2786 |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2787 def Test_popup_dialog() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2788 v9.CheckDefAndScriptFailure(['popup_dialog({"a": 10}, {})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String, Number or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2789 v9.CheckDefAndScriptFailure(['popup_dialog("a", [1, 2])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2']) |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2790 enddef |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2791 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2792 def Test_popup_filter_menu() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2793 v9.CheckDefAndScriptFailure(['popup_filter_menu("x", "")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2794 v9.CheckDefAndScriptFailure(['popup_filter_menu(1, 1)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2795 var id: number = popup_menu(["one", "two", "three"], {}) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2796 popup_filter_menu(id, '') |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2797 popup_close(id) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2798 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2799 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2800 def Test_popup_filter_yesno() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2801 v9.CheckDefAndScriptFailure(['popup_filter_yesno("x", "")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2802 v9.CheckDefAndScriptFailure(['popup_filter_yesno(1, 1)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2803 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2804 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2805 def Test_popup_getoptions() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2806 v9.CheckDefAndScriptFailure(['popup_getoptions("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2807 v9.CheckDefAndScriptFailure(['popup_getoptions(true)'], ['E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2808 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2809 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2810 def Test_popup_getpos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2811 v9.CheckDefAndScriptFailure(['popup_getpos("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2812 v9.CheckDefAndScriptFailure(['popup_getpos(true)'], ['E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2813 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2814 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2815 def Test_popup_hide() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2816 v9.CheckDefAndScriptFailure(['popup_hide("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2817 v9.CheckDefAndScriptFailure(['popup_hide(true)'], ['E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2818 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2819 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2820 def Test_popup_locate() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2821 v9.CheckDefAndScriptFailure(['popup_locate("a", 20)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2822 v9.CheckDefAndScriptFailure(['popup_locate(10, "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2823 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
2824 |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2825 def Test_popup_menu() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2826 v9.CheckDefAndScriptFailure(['popup_menu({"a": 10}, {})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String, Number or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2827 v9.CheckDefAndScriptFailure(['popup_menu("a", [1, 2])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2']) |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2828 enddef |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2829 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2830 def Test_popup_move() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2831 v9.CheckDefAndScriptFailure(['popup_move("x", {})'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2832 v9.CheckDefAndScriptFailure(['popup_move(1, [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2833 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2834 |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2835 def Test_popup_notification() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2836 v9.CheckDefAndScriptFailure(['popup_notification({"a": 10}, {})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String, Number or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2837 v9.CheckDefAndScriptFailure(['popup_notification("a", [1, 2])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2']) |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2838 enddef |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
2839 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2840 def Test_popup_setoptions() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2841 v9.CheckDefAndScriptFailure(['popup_setoptions("x", {})'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2842 v9.CheckDefAndScriptFailure(['popup_setoptions(1, [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2843 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2844 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2845 def Test_popup_settext() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2846 v9.CheckDefAndScriptFailure(['popup_settext("x", [])'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2847 v9.CheckDefAndScriptFailure(['popup_settext(1, 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1222: String or List required for argument 2']) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2848 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
2849 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2850 def Test_popup_show() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2851 v9.CheckDefAndScriptFailure(['popup_show("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2852 v9.CheckDefAndScriptFailure(['popup_show(true)'], ['E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2853 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2854 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2855 def Test_prevnonblank() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2856 v9.CheckDefAndScriptFailure(['prevnonblank(null)'], ['E1013: Argument 1: type mismatch, expected string but got special', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2857 v9.CheckDefExecAndScriptFailure(['prevnonblank("")'], 'E1209: Invalid value for a line number') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2858 assert_equal(0, prevnonblank(1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2859 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2860 |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2861 def Test_printf() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2862 v9.CheckDefAndScriptFailure(['printf([1])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2863 printf(0x10)->assert_equal('16') |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2864 assert_equal(" abc", "abc"->printf("%4s")) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2865 enddef |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
2866 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2867 def Test_prompt_getprompt() |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2868 if !has('channel') |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2869 CheckFeature channel |
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
2870 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2871 v9.CheckDefAndScriptFailure(['prompt_getprompt([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
25110
e38a406ccc46
patch 8.2.3092: Vim9: builtin function test fails without +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25094
diff
changeset
|
2872 assert_equal('', prompt_getprompt('NonExistingBuf')) |
e38a406ccc46
patch 8.2.3092: Vim9: builtin function test fails without +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25094
diff
changeset
|
2873 endif |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2874 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2875 |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2876 def Test_prompt_setcallback() |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2877 if !has('channel') |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2878 CheckFeature channel |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2879 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2880 v9.CheckDefAndScriptFailure(['prompt_setcallback(true, "1")'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2881 endif |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2882 enddef |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2883 |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2884 def Test_prompt_setinterrupt() |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2885 if !has('channel') |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2886 CheckFeature channel |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2887 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2888 v9.CheckDefAndScriptFailure(['prompt_setinterrupt(true, "1")'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2889 endif |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2890 enddef |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
2891 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2892 def Test_prompt_setprompt() |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2893 if !has('channel') |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2894 CheckFeature channel |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2895 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2896 v9.CheckDefAndScriptFailure(['prompt_setprompt([], "p")'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2897 v9.CheckDefAndScriptFailure(['prompt_setprompt(1, [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2898 endif |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2899 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2900 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2901 def Test_prop_add() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2902 v9.CheckDefAndScriptFailure(['prop_add("a", 2, {})'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2903 v9.CheckDefAndScriptFailure(['prop_add(1, "b", {})'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2904 v9.CheckDefAndScriptFailure(['prop_add(1, 2, [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2905 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2906 |
25640
78ef12e0ce8c
patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents:
25571
diff
changeset
|
2907 def Test_prop_add_list() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2908 v9.CheckDefAndScriptFailure(['prop_add_list([], [])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2909 v9.CheckDefAndScriptFailure(['prop_add_list({}, {})'], ['E1013: Argument 2: type mismatch, expected list<any> but got dict<unknown>', 'E1211: List required for argument 2']) |
25640
78ef12e0ce8c
patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents:
25571
diff
changeset
|
2910 enddef |
78ef12e0ce8c
patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents:
25571
diff
changeset
|
2911 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2912 def Test_prop_clear() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2913 v9.CheckDefAndScriptFailure(['prop_clear("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2914 v9.CheckDefAndScriptFailure(['prop_clear(1, "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2915 v9.CheckDefAndScriptFailure(['prop_clear(1, 2, [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2916 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
2917 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2918 def Test_prop_find() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2919 v9.CheckDefAndScriptFailure(['prop_find([1, 2])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2920 v9.CheckDefAndScriptFailure(['prop_find([1, 2], "k")'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2921 v9.CheckDefAndScriptFailure(['prop_find({"a": 10}, ["a"])'], ['E1013: Argument 2: type mismatch, expected string but got list<string>', 'E1174: String required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2922 assert_fails("prop_find({}, '')", 'E474:') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2923 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2924 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2925 def Test_prop_list() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2926 v9.CheckDefAndScriptFailure(['prop_list("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2927 v9.CheckDefAndScriptFailure(['prop_list(1, [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2928 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2929 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2930 def Test_prop_remove() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2931 v9.CheckDefAndScriptFailure(['prop_remove([])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2932 v9.CheckDefAndScriptFailure(['prop_remove({}, "a")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2933 v9.CheckDefAndScriptFailure(['prop_remove({}, 1, "b")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2934 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
2935 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2936 def Test_prop_type_add() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2937 v9.CheckDefAndScriptFailure(['prop_type_add({"a": 10}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2938 v9.CheckDefAndScriptFailure(['prop_type_add("a", "b")'], ['E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2939 assert_fails("prop_type_add('', {highlight: 'Search'})", 'E474:') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2940 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2941 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2942 def Test_prop_type_change() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2943 v9.CheckDefAndScriptFailure(['prop_type_change({"a": 10}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2944 v9.CheckDefAndScriptFailure(['prop_type_change("a", "b")'], ['E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2945 assert_fails("prop_type_change('', {highlight: 'Search'})", 'E474:') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2946 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2947 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2948 def Test_prop_type_delete() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2949 v9.CheckDefAndScriptFailure(['prop_type_delete({"a": 10})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2950 v9.CheckDefAndScriptFailure(['prop_type_delete({"a": 10}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2951 v9.CheckDefAndScriptFailure(['prop_type_delete("a", "b")'], ['E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2952 assert_fails("prop_type_delete('')", 'E474:') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2953 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2954 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2955 def Test_prop_type_get() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2956 v9.CheckDefAndScriptFailure(['prop_type_get({"a": 10})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2957 v9.CheckDefAndScriptFailure(['prop_type_get({"a": 10}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2958 v9.CheckDefAndScriptFailure(['prop_type_get("a", "b")'], ['E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
2959 assert_fails("prop_type_get('')", 'E474:') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2960 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2961 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2962 def Test_prop_type_list() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2963 v9.CheckDefAndScriptFailure(['prop_type_list(["a"])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<string>', 'E1206: Dictionary required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2964 v9.CheckDefAndScriptFailure(['prop_type_list(2)'], ['E1013: Argument 1: type mismatch, expected dict<any> but got number', 'E1206: Dictionary required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2965 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2966 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2967 def Test_py3eval() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2968 if !has('python3') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2969 CheckFeature python3 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2970 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2971 v9.CheckDefAndScriptFailure(['py3eval([2])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2972 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2973 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2974 def Test_pyeval() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2975 if !has('python') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2976 CheckFeature python |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2977 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2978 v9.CheckDefAndScriptFailure(['pyeval([2])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2979 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2980 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2981 def Test_pyxeval() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2982 if !has('python') && !has('python3') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2983 CheckFeature python |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2984 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2985 v9.CheckDefAndScriptFailure(['pyxeval([2])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2986 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
2987 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2988 def Test_rand() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2989 v9.CheckDefAndScriptFailure(['rand(10)'], ['E1013: Argument 1: type mismatch, expected list<number> but got number', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2990 v9.CheckDefFailure(['rand(["a"])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<string>') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2991 assert_true(rand() >= 0) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2992 assert_true(rand(srand()) >= 0) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2993 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
2994 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
2995 def Test_range() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2996 v9.CheckDefAndScriptFailure(['range("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2997 v9.CheckDefAndScriptFailure(['range(10, "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
2998 v9.CheckDefAndScriptFailure(['range(10, 20, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
27503
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
2999 |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
3000 # returns a list<number> but it's not declared as such |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
3001 assert_equal(['x', 'x'], range(2)->map((i, v) => 'x')) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3002 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3003 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3004 def Test_readdir() |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3005 eval expand('sautest')->readdir((e) => e[0] !=# '.') |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3006 eval expand('sautest')->readdirex((e) => e.name[0] !=# '.') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3007 v9.CheckDefAndScriptFailure(['readdir(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3008 v9.CheckDefAndScriptFailure(['readdir("a", "1", [3])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3009 if has('unix') |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3010 # only fails on Unix-like systems |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3011 assert_fails('readdir("")', 'E484: Can''t open file') |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3012 endif |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3013 enddef |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3014 |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3015 def Test_readdirex() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3016 v9.CheckDefAndScriptFailure(['readdirex(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3017 v9.CheckDefAndScriptFailure(['readdirex("a", "1", [3])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3018 if has('unix') |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3019 # only fails on Unix-like systems |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3020 assert_fails('readdirex("")', 'E484: Can''t open file') |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3021 endif |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3022 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3023 |
23602
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3024 def Test_readblob() |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3025 var blob = 0z12341234 |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3026 writefile(blob, 'Xreadblob') |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3027 var read: blob = readblob('Xreadblob') |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3028 assert_equal(blob, read) |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3029 |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3030 var lines =<< trim END |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3031 var read: list<string> = readblob('Xreadblob') |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3032 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3033 v9.CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected list<string> but got blob', 1) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3034 v9.CheckDefExecAndScriptFailure(['readblob("")'], 'E484: Can''t open file <empty>') |
23602
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3035 delete('Xreadblob') |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3036 enddef |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3037 |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3038 def Test_readfile() |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3039 var text = ['aaa', 'bbb', 'ccc'] |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3040 writefile(text, 'Xreadfile') |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3041 var read: list<string> = readfile('Xreadfile') |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3042 assert_equal(text, read) |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3043 assert_equal([7, 7, 7], readfile('Xreadfile')->map((_, _) => 7)) |
23602
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3044 |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3045 var lines =<< trim END |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3046 var read: dict<string> = readfile('Xreadfile') |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3047 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3048 v9.CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected dict<string> but got list<string>', 1) |
23602
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3049 delete('Xreadfile') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3050 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3051 v9.CheckDefAndScriptFailure(['readfile("a", 0z10)'], ['E1013: Argument 2: type mismatch, expected string but got blob', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3052 v9.CheckDefAndScriptFailure(['readfile("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3053 v9.CheckDefExecAndScriptFailure(['readfile("")'], 'E1175: Non-empty string required for argument 1') |
23602
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3054 enddef |
7b3317e959e3
patch 8.2.2343: Vim9: return type of readfile() is any
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
3055 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3056 def Test_reduce() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3057 v9.CheckDefAndScriptFailure(['reduce({a: 10}, "1")'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E1252: String, List or Blob required for argument 1']) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3058 assert_equal(6, [1, 2, 3]->reduce((r, c) => r + c, 0)) |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3059 assert_equal(11, 0z0506->reduce((r, c) => r + c, 0)) |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3060 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3061 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3062 def Test_reltime() |
25250
532faf893d37
patch 8.2.3161: Vim9: no error when reltime() has invalid arguments
Bram Moolenaar <Bram@vim.org>
parents:
25240
diff
changeset
|
3063 CheckFeature reltime |
532faf893d37
patch 8.2.3161: Vim9: no error when reltime() has invalid arguments
Bram Moolenaar <Bram@vim.org>
parents:
25240
diff
changeset
|
3064 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3065 v9.CheckDefExecAndScriptFailure(['[]->reltime()'], 'E474:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3066 v9.CheckDefExecAndScriptFailure(['[]->reltime([])'], 'E474:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3067 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3068 v9.CheckDefAndScriptFailure(['reltime("x")'], ['E1013: Argument 1: type mismatch, expected list<number> but got string', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3069 v9.CheckDefFailure(['reltime(["x", "y"])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<string>') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3070 v9.CheckDefAndScriptFailure(['reltime([1, 2], 10)'], ['E1013: Argument 2: type mismatch, expected list<number> but got number', 'E1211: List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3071 v9.CheckDefFailure(['reltime([1, 2], ["a", "b"])'], 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3072 var start: list<any> = reltime() |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3073 assert_true(type(reltime(start)) == v:t_list) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3074 var end: list<any> = reltime() |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3075 assert_true(type(reltime(start, end)) == v:t_list) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3076 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3077 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3078 def Test_reltimefloat() |
25250
532faf893d37
patch 8.2.3161: Vim9: no error when reltime() has invalid arguments
Bram Moolenaar <Bram@vim.org>
parents:
25240
diff
changeset
|
3079 CheckFeature reltime |
532faf893d37
patch 8.2.3161: Vim9: no error when reltime() has invalid arguments
Bram Moolenaar <Bram@vim.org>
parents:
25240
diff
changeset
|
3080 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3081 v9.CheckDefExecAndScriptFailure(['[]->reltimefloat()'], 'E474:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3082 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3083 v9.CheckDefAndScriptFailure(['reltimefloat("x")'], ['E1013: Argument 1: type mismatch, expected list<number> but got string', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3084 v9.CheckDefFailure(['reltimefloat([1.1])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<float>') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3085 assert_true(type(reltimefloat(reltime())) == v:t_float) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3086 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3087 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3088 def Test_reltimestr() |
25250
532faf893d37
patch 8.2.3161: Vim9: no error when reltime() has invalid arguments
Bram Moolenaar <Bram@vim.org>
parents:
25240
diff
changeset
|
3089 CheckFeature reltime |
532faf893d37
patch 8.2.3161: Vim9: no error when reltime() has invalid arguments
Bram Moolenaar <Bram@vim.org>
parents:
25240
diff
changeset
|
3090 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3091 v9.CheckDefExecAndScriptFailure(['[]->reltimestr()'], 'E474:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3092 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3093 v9.CheckDefAndScriptFailure(['reltimestr(true)'], ['E1013: Argument 1: type mismatch, expected list<number> but got bool', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3094 v9.CheckDefFailure(['reltimestr([true])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<bool>') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3095 assert_true(type(reltimestr(reltime())) == v:t_string) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3096 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3097 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3098 def Test_remote_expr() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3099 CheckFeature clientserver |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3100 CheckEnv DISPLAY |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3101 v9.CheckDefAndScriptFailure(['remote_expr(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3102 v9.CheckDefAndScriptFailure(['remote_expr("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3103 v9.CheckDefAndScriptFailure(['remote_expr("a", "b", 3)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3104 v9.CheckDefAndScriptFailure(['remote_expr("a", "b", "c", "d")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3105 v9.CheckDefExecAndScriptFailure(['remote_expr("", "")'], 'E241: Unable to send to ') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3106 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3107 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3108 def Test_remote_foreground() |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3109 CheckFeature clientserver |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3110 # remote_foreground() doesn't fail on MS-Windows |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3111 CheckNotMSWindows |
25143
54a547489e49
patch 8.2.3108: test for remote_foreground() fails
Bram Moolenaar <Bram@vim.org>
parents:
25110
diff
changeset
|
3112 CheckEnv DISPLAY |
54a547489e49
patch 8.2.3108: test for remote_foreground() fails
Bram Moolenaar <Bram@vim.org>
parents:
25110
diff
changeset
|
3113 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3114 v9.CheckDefAndScriptFailure(['remote_foreground(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3115 assert_fails('remote_foreground("NonExistingServer")', 'E241:') |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
3116 assert_fails('remote_foreground("")', 'E241:') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3117 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3118 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3119 def Test_remote_peek() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3120 CheckFeature clientserver |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3121 CheckEnv DISPLAY |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3122 v9.CheckDefAndScriptFailure(['remote_peek(0z10)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3123 v9.CheckDefAndScriptFailure(['remote_peek("a5b6c7", [1])'], ['E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3124 v9.CheckDefExecAndScriptFailure(['remote_peek("")'], 'E573: Invalid server id used') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3125 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3126 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3127 def Test_remote_read() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3128 CheckFeature clientserver |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3129 CheckEnv DISPLAY |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3130 v9.CheckDefAndScriptFailure(['remote_read(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3131 v9.CheckDefAndScriptFailure(['remote_read("a", "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3132 v9.CheckDefExecAndScriptFailure(['remote_read("")'], 'E573: Invalid server id used') |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3133 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3134 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3135 def Test_remote_send() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3136 CheckFeature clientserver |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3137 CheckEnv DISPLAY |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3138 v9.CheckDefAndScriptFailure(['remote_send(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3139 v9.CheckDefAndScriptFailure(['remote_send("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3140 v9.CheckDefAndScriptFailure(['remote_send("a", "b", 3)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
3141 assert_fails('remote_send("", "")', 'E241:') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3142 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3143 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3144 def Test_remote_startserver() |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3145 CheckFeature clientserver |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3146 CheckEnv DISPLAY |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3147 v9.CheckDefAndScriptFailure(['remote_startserver({})'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3148 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3149 |
25290
8b7ea875afed
patch 8.2.3182: Vim9: crash when using removing items from a constant list
Bram Moolenaar <Bram@vim.org>
parents:
25288
diff
changeset
|
3150 def Test_remove_const_list() |
8b7ea875afed
patch 8.2.3182: Vim9: crash when using removing items from a constant list
Bram Moolenaar <Bram@vim.org>
parents:
25288
diff
changeset
|
3151 var l: list<number> = [1, 2, 3, 4] |
8b7ea875afed
patch 8.2.3182: Vim9: crash when using removing items from a constant list
Bram Moolenaar <Bram@vim.org>
parents:
25288
diff
changeset
|
3152 assert_equal([1, 2], remove(l, 0, 1)) |
8b7ea875afed
patch 8.2.3182: Vim9: crash when using removing items from a constant list
Bram Moolenaar <Bram@vim.org>
parents:
25288
diff
changeset
|
3153 assert_equal([3, 4], l) |
8b7ea875afed
patch 8.2.3182: Vim9: crash when using removing items from a constant list
Bram Moolenaar <Bram@vim.org>
parents:
25288
diff
changeset
|
3154 enddef |
8b7ea875afed
patch 8.2.3182: Vim9: crash when using removing items from a constant list
Bram Moolenaar <Bram@vim.org>
parents:
25288
diff
changeset
|
3155 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3156 def Test_remove() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3157 v9.CheckDefAndScriptFailure(['remove("a", 1)'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1228: List, Dictionary or Blob required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3158 v9.CheckDefAndScriptFailure(['remove([], "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3159 v9.CheckDefAndScriptFailure(['remove([], 1, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3160 v9.CheckDefAndScriptFailure(['remove({}, 1.1)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1220: String or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3161 v9.CheckDefAndScriptFailure(['remove(0z10, "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3162 v9.CheckDefAndScriptFailure(['remove(0z20, 1, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3163 var l: any = [1, 2, 3, 4] |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3164 remove(l, 1) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3165 assert_equal([1, 3, 4], l) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3166 remove(l, 0, 1) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3167 assert_equal([4], l) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3168 var b: any = 0z1234.5678.90 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3169 remove(b, 1) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3170 assert_equal(0z1256.7890, b) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3171 remove(b, 1, 2) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3172 assert_equal(0z1290, b) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3173 var d: any = {a: 10, b: 20, c: 30} |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3174 remove(d, 'b') |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3175 assert_equal({a: 10, c: 30}, d) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3176 var d2: any = {1: 'a', 2: 'b', 3: 'c'} |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3177 remove(d2, 2) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3178 assert_equal({1: 'a', 3: 'c'}, d2) |
27503
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
3179 |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
3180 # using declared type |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
3181 var x: string = range(2)->extend(['x'])->remove(2) |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27497
diff
changeset
|
3182 assert_equal('x', x) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3183 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3184 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3185 def Test_remove_return_type() |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
3186 var l = remove({one: [1, 2], two: [3, 4]}, 'one') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3187 var res = 0 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3188 for n in l |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3189 res += n |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3190 endfor |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3191 res->assert_equal(3) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3192 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3193 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3194 def Test_rename() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3195 v9.CheckDefAndScriptFailure(['rename(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3196 v9.CheckDefAndScriptFailure(['rename("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3197 rename('', '')->assert_equal(0) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3198 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3199 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3200 def Test_repeat() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3201 v9.CheckDefAndScriptFailure(['repeat(1.1, 2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1224: String, Number or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3202 v9.CheckDefAndScriptFailure(['repeat({a: 10}, 2)'], ['E1013: Argument 1: type mismatch, expected string but got dict<', 'E1224: String, Number or List required for argument 1']) |
25449
5dce28f92d04
patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number
Bram Moolenaar <Bram@vim.org>
parents:
25443
diff
changeset
|
3203 var lines =<< trim END |
5dce28f92d04
patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number
Bram Moolenaar <Bram@vim.org>
parents:
25443
diff
changeset
|
3204 assert_equal('aaa', repeat('a', 3)) |
5dce28f92d04
patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number
Bram Moolenaar <Bram@vim.org>
parents:
25443
diff
changeset
|
3205 assert_equal('111', repeat(1, 3)) |
5dce28f92d04
patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number
Bram Moolenaar <Bram@vim.org>
parents:
25443
diff
changeset
|
3206 assert_equal([1, 1, 1], repeat([1], 3)) |
5dce28f92d04
patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number
Bram Moolenaar <Bram@vim.org>
parents:
25443
diff
changeset
|
3207 var s = '-' |
5dce28f92d04
patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number
Bram Moolenaar <Bram@vim.org>
parents:
25443
diff
changeset
|
3208 s ..= repeat(5, 3) |
5dce28f92d04
patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number
Bram Moolenaar <Bram@vim.org>
parents:
25443
diff
changeset
|
3209 assert_equal('-555', s) |
5dce28f92d04
patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number
Bram Moolenaar <Bram@vim.org>
parents:
25443
diff
changeset
|
3210 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3211 v9.CheckDefAndScriptSuccess(lines) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3212 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3213 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3214 def Test_resolve() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3215 v9.CheckDefAndScriptFailure(['resolve([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3216 assert_equal('SomeFile', resolve('SomeFile')) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3217 resolve('')->assert_equal('') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3218 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3219 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3220 def Test_reverse() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3221 v9.CheckDefAndScriptFailure(['reverse(10)'], ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1226: List or Blob required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3222 v9.CheckDefAndScriptFailure(['reverse("abc")'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1226: List or Blob required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3223 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3224 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3225 def Test_reverse_return_type() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3226 var l = reverse([1, 2, 3]) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3227 var res = 0 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3228 for n in l |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3229 res += n |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3230 endfor |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3231 res->assert_equal(6) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3232 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3233 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3234 def Test_rubyeval() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3235 if !has('ruby') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3236 CheckFeature ruby |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3237 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3238 v9.CheckDefAndScriptFailure(['rubyeval([2])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3239 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3240 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3241 def Test_screenattr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3242 v9.CheckDefAndScriptFailure(['screenattr("x", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3243 v9.CheckDefAndScriptFailure(['screenattr(1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3244 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3245 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3246 def Test_screenchar() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3247 v9.CheckDefAndScriptFailure(['screenchar("x", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3248 v9.CheckDefAndScriptFailure(['screenchar(1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3249 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3250 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3251 def Test_screenchars() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3252 assert_equal(['x'], screenchars(1, 1)->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3253 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3254 v9.CheckDefAndScriptFailure(['screenchars("x", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3255 v9.CheckDefAndScriptFailure(['screenchars(1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3256 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3257 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3258 def Test_screenpos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3259 v9.CheckDefAndScriptFailure(['screenpos("a", 1, 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3260 v9.CheckDefAndScriptFailure(['screenpos(1, "b", 1)'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3261 v9.CheckDefAndScriptFailure(['screenpos(1, 1, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3262 assert_equal({col: 1, row: 1, endcol: 1, curscol: 1}, screenpos(1, 1, 1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3263 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3264 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3265 def Test_screenstring() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3266 v9.CheckDefAndScriptFailure(['screenstring("x", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3267 v9.CheckDefAndScriptFailure(['screenstring(1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3268 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3269 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3270 def Test_search() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3271 new |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3272 setline(1, ['foo', 'bar']) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3273 var val = 0 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3274 # skip expr returns boolean |
23428
5807e3958e38
patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
3275 search('bar', 'W', 0, 0, () => val == 1)->assert_equal(2) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3276 :1 |
23428
5807e3958e38
patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
3277 search('bar', 'W', 0, 0, () => val == 0)->assert_equal(0) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3278 # skip expr returns number, only 0 and 1 are accepted |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3279 :1 |
23428
5807e3958e38
patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
3280 search('bar', 'W', 0, 0, () => 0)->assert_equal(2) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3281 :1 |
23428
5807e3958e38
patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
3282 search('bar', 'W', 0, 0, () => 1)->assert_equal(0) |
5807e3958e38
patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
3283 assert_fails("search('bar', '', 0, 0, () => -1)", 'E1023:') |
5807e3958e38
patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
3284 assert_fails("search('bar', '', 0, 0, () => -1)", 'E1023:') |
24608
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3285 |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3286 setline(1, "find this word") |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3287 normal gg |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3288 var col = 7 |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3289 assert_equal(1, search('this', '', 0, 0, 'col(".") > col')) |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3290 normal 0 |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3291 assert_equal([1, 6], searchpos('this', '', 0, 0, 'col(".") > col')) |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3292 |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3293 col = 5 |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3294 normal 0 |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3295 assert_equal(0, search('this', '', 0, 0, 'col(".") > col')) |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3296 normal 0 |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3297 assert_equal([0, 0], searchpos('this', '', 0, 0, 'col(".") > col')) |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3298 bwipe! |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3299 v9.CheckDefAndScriptFailure(['search(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3300 v9.CheckDefAndScriptFailure(['search("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3301 v9.CheckDefAndScriptFailure(['search("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3302 v9.CheckDefAndScriptFailure(['search("a", "b", 3, "d")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3303 new |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3304 setline(1, "match this") |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3305 v9.CheckDefAndScriptFailure(['search("a", "", 9, 0, [0])'], ['E1013: Argument 5: type mismatch, expected func(...): any but got list<number>', 'E730: Using a List as a String']) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3306 bwipe! |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3307 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3308 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3309 def Test_searchcount() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3310 new |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3311 setline(1, "foo bar") |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3312 :/foo |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
3313 searchcount({recompute: true}) |
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
3314 ->assert_equal({ |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3315 exact_match: 1, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3316 current: 1, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3317 total: 1, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3318 maxcount: 99, |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3319 incomplete: 0}) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3320 bwipe! |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3321 v9.CheckDefAndScriptFailure(['searchcount([1])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 1']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3322 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3323 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3324 def Test_searchdecl() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3325 searchdecl('blah', true, true)->assert_equal(1) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3326 v9.CheckDefAndScriptFailure(['searchdecl(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3327 v9.CheckDefAndScriptFailure(['searchdecl("a", 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3328 v9.CheckDefAndScriptFailure(['searchdecl("a", true, 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3329 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3330 |
24606
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3331 def Test_searchpair() |
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3332 new |
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3333 setline(1, "here { and } there") |
24608
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3334 |
24606
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3335 normal f{ |
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3336 var col = 15 |
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3337 assert_equal(1, searchpair('{', '', '}', '', 'col(".") > col')) |
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3338 assert_equal(12, col('.')) |
24608
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3339 normal 0f{ |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3340 assert_equal([1, 12], searchpairpos('{', '', '}', '', 'col(".") > col')) |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3341 |
24606
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3342 col = 8 |
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3343 normal 0f{ |
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3344 assert_equal(0, searchpair('{', '', '}', '', 'col(".") > col')) |
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3345 assert_equal(6, col('.')) |
24608
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3346 normal 0f{ |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3347 assert_equal([0, 0], searchpairpos('{', '', '}', '', 'col(".") > col')) |
cb031f421ece
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24606
diff
changeset
|
3348 |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3349 # searchpair with empty strings |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3350 normal 8| |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3351 assert_equal(0, searchpair('', '', '')) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3352 assert_equal([0, 0], searchpairpos('', '', '')) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3353 |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3354 assert_equal(['x', 'x'], searchpairpos('', '', '')->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3355 |
24637
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3356 var lines =<< trim END |
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3357 vim9script |
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3358 setline(1, '()') |
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3359 normal gg |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3360 func RetList() |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3361 return [0] |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3362 endfunc |
24637
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3363 def Fail() |
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3364 try |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3365 searchpairpos('(', '', ')', 'nW', 'RetList()') |
24637
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3366 catch |
24659
982516c8d692
patch 8.2.2868: Vim9: when executing compiled expression trylevel is changed
Bram Moolenaar <Bram@vim.org>
parents:
24637
diff
changeset
|
3367 g:caught = 'yes' |
24637
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3368 endtry |
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3369 enddef |
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3370 Fail() |
4a4f64cdc798
patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level
Bram Moolenaar <Bram@vim.org>
parents:
24608
diff
changeset
|
3371 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3372 v9.CheckScriptSuccess(lines) |
24659
982516c8d692
patch 8.2.2868: Vim9: when executing compiled expression trylevel is changed
Bram Moolenaar <Bram@vim.org>
parents:
24637
diff
changeset
|
3373 assert_equal('yes', g:caught) |
982516c8d692
patch 8.2.2868: Vim9: when executing compiled expression trylevel is changed
Bram Moolenaar <Bram@vim.org>
parents:
24637
diff
changeset
|
3374 unlet g:caught |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3375 bwipe! |
25340
37001467805f
patch 8.2.3207: Vim9: crash when compiling string fails
Bram Moolenaar <Bram@vim.org>
parents:
25338
diff
changeset
|
3376 |
37001467805f
patch 8.2.3207: Vim9: crash when compiling string fails
Bram Moolenaar <Bram@vim.org>
parents:
25338
diff
changeset
|
3377 lines =<< trim END |
25346
f874e7095878
patch 8.2.3210: Vim9: searchpair() sixth argument is compiled
Bram Moolenaar <Bram@vim.org>
parents:
25340
diff
changeset
|
3378 echo searchpair("a", "b", "c", "d", "f", 33) |
25340
37001467805f
patch 8.2.3207: Vim9: crash when compiling string fails
Bram Moolenaar <Bram@vim.org>
parents:
25338
diff
changeset
|
3379 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3380 v9.CheckDefAndScriptFailure(lines, ['E1001: Variable not found: f', 'E475: Invalid argument: d']) |
26650
a07323eb647f
patch 8.2.3854: Vim9: inconsistent arguments for test functions
Bram Moolenaar <Bram@vim.org>
parents:
26638
diff
changeset
|
3381 |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3382 var errors = ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1'] |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3383 v9.CheckDefAndScriptFailure(['searchpair(1, "b", "c")'], errors) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3384 v9.CheckDefAndScriptFailure(['searchpairpos(1, "b", "c")'], errors) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3385 |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3386 errors = ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2'] |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3387 v9.CheckDefAndScriptFailure(['searchpair("a", 2, "c")'], errors) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3388 v9.CheckDefAndScriptFailure(['searchpairpos("a", 2, "c")'], errors) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3389 |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3390 errors = ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3'] |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3391 v9.CheckDefAndScriptFailure(['searchpair("a", "b", 3)'], errors) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3392 v9.CheckDefAndScriptFailure(['searchpairpos("a", "b", 3)'], errors) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3393 |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3394 errors = ['E1013: Argument 4: type mismatch, expected string but got number', 'E1174: String required for argument 4'] |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3395 v9.CheckDefAndScriptFailure(['searchpair("a", "b", "c", 4)'], errors) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3396 |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3397 new |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3398 setline(1, "match this") |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3399 errors = ['E1013: Argument 5: type mismatch, expected func(...): any but got list<number>', 'E730: Using a List as a String'] |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3400 v9.CheckDefAndScriptFailure(['searchpair("a", "b", "c", "r", [0])'], errors) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3401 v9.CheckDefAndScriptFailure(['searchpairpos("a", "b", "c", "r", [0])'], errors) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3402 bwipe! |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3403 |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3404 errors = ['E1013: Argument 6: type mismatch, expected number but got string', 'E1210: Number required for argument 6'] |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3405 v9.CheckDefAndScriptFailure(['searchpair("a", "b", "c", "r", "1", "f")'], errors) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3406 v9.CheckDefAndScriptFailure(['searchpairpos("a", "b", "c", "r", "1", "f")'], errors) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3407 |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3408 errors = ['E1013: Argument 7: type mismatch, expected number but got string', 'E1210: Number required for argument 7'] |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3409 v9.CheckDefAndScriptFailure(['searchpair("a", "b", "c", "r", "1", 3, "g")'], errors) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3410 v9.CheckDefAndScriptFailure(['searchpairpos("a", "b", "c", "r", "1", 3, "g")'], errors) |
24606
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3411 enddef |
a4fda40e0bb9
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
24584
diff
changeset
|
3412 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3413 def Test_searchpos() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3414 assert_equal(['x', 'x'], searchpos('.')->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3415 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3416 v9.CheckDefAndScriptFailure(['searchpos(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3417 v9.CheckDefAndScriptFailure(['searchpos("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3418 v9.CheckDefAndScriptFailure(['searchpos("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3419 v9.CheckDefAndScriptFailure(['searchpos("a", "b", 3, "d")'], ['E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4']) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3420 new |
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3421 setline(1, "match this") |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3422 v9.CheckDefAndScriptFailure(['searchpos("a", "", 9, 0, [0])'], ['E1013: Argument 5: type mismatch, expected func(...): any but got list<number>', 'E730: Using a List as a String']) |
26751
4ea53126f78f
patch 8.2.3904: Vim9: skip expression type is not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3423 bwipe! |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3424 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3425 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3426 def Test_server2client() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3427 CheckFeature clientserver |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3428 CheckEnv DISPLAY |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3429 v9.CheckDefAndScriptFailure(['server2client(10, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3430 v9.CheckDefAndScriptFailure(['server2client("a", 10)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3431 v9.CheckDefExecAndScriptFailure(['server2client("", "a")'], 'E573: Invalid server id used') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3432 v9.CheckDefExecAndScriptFailure(['server2client("", "")'], 'E573: Invalid server id used') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3433 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3434 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3435 def Test_shellescape() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3436 v9.CheckDefAndScriptFailure(['shellescape(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3437 v9.CheckDefAndScriptFailure(['shellescape("a", 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3438 if has('unix') |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3439 assert_equal("''", shellescape('')) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3440 endif |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3441 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3442 |
23788
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3443 def Test_set_get_bufline() |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3444 # similar to Test_setbufline_getbufline() |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3445 var lines =<< trim END |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3446 new |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3447 var b = bufnr('%') |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3448 hide |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3449 assert_equal(0, setbufline(b, 1, ['foo', 'bar'])) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3450 assert_equal(['foo'], getbufline(b, 1)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3451 assert_equal(['bar'], getbufline(b, '$')) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3452 assert_equal(['foo', 'bar'], getbufline(b, 1, 2)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3453 exe "bd!" b |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3454 assert_equal([], getbufline(b, 1, 2)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3455 |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3456 split Xtest |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3457 setline(1, ['a', 'b', 'c']) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3458 b = bufnr('%') |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3459 wincmd w |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3460 |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3461 assert_equal(1, setbufline(b, 5, 'x')) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3462 assert_equal(1, setbufline(b, 5, ['x'])) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3463 assert_equal(1, setbufline(b, 5, [])) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3464 assert_equal(1, setbufline(b, 5, test_null_list())) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3465 |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3466 assert_equal(1, 'x'->setbufline(bufnr('$') + 1, 1)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3467 assert_equal(1, ['x']->setbufline(bufnr('$') + 1, 1)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3468 assert_equal(1, []->setbufline(bufnr('$') + 1, 1)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3469 assert_equal(1, test_null_list()->setbufline(bufnr('$') + 1, 1)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3470 |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3471 assert_equal(['a', 'b', 'c'], getbufline(b, 1, '$')) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3472 |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3473 assert_equal(0, setbufline(b, 4, ['d', 'e'])) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3474 assert_equal(['c'], b->getbufline(3)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3475 assert_equal(['d'], getbufline(b, 4)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3476 assert_equal(['e'], getbufline(b, 5)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3477 assert_equal([], getbufline(b, 6)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3478 assert_equal([], getbufline(b, 2, 1)) |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3479 |
23875
54b583156d53
patch 8.2.2479: set/getbufline test fails without the job feature
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
3480 if has('job') |
24812
8fdf839af1f4
patch 8.2.2944: Vim9: no error when using job or channel as a string
Bram Moolenaar <Bram@vim.org>
parents:
24808
diff
changeset
|
3481 setbufline(b, 2, [function('eval'), {key: 123}, string(test_null_job())]) |
23875
54b583156d53
patch 8.2.2479: set/getbufline test fails without the job feature
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
3482 assert_equal(["function('eval')", |
54b583156d53
patch 8.2.2479: set/getbufline test fails without the job feature
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
3483 "{'key': 123}", |
54b583156d53
patch 8.2.2479: set/getbufline test fails without the job feature
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
3484 "no process"], |
54b583156d53
patch 8.2.2479: set/getbufline test fails without the job feature
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
3485 getbufline(b, 2, 4)) |
54b583156d53
patch 8.2.2479: set/getbufline test fails without the job feature
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
3486 endif |
23788
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3487 |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3488 exe 'bwipe! ' .. b |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3489 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3490 v9.CheckDefAndScriptSuccess(lines) |
23788
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3491 enddef |
d12ef361d9de
patch 8.2.2435: setline() gives an error for some types
Bram Moolenaar <Bram@vim.org>
parents:
23786
diff
changeset
|
3492 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3493 def Test_setbufvar() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3494 setbufvar(bufnr('%'), '&syntax', 'vim') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3495 &syntax->assert_equal('vim') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3496 setbufvar(bufnr('%'), '&ts', 16) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3497 &ts->assert_equal(16) |
23483
ce7d6b461660
patch 8.2.2284: Vim9: cannot set an option to a boolean value
Bram Moolenaar <Bram@vim.org>
parents:
23458
diff
changeset
|
3498 setbufvar(bufnr('%'), '&ai', true) |
ce7d6b461660
patch 8.2.2284: Vim9: cannot set an option to a boolean value
Bram Moolenaar <Bram@vim.org>
parents:
23458
diff
changeset
|
3499 &ai->assert_equal(true) |
ce7d6b461660
patch 8.2.2284: Vim9: cannot set an option to a boolean value
Bram Moolenaar <Bram@vim.org>
parents:
23458
diff
changeset
|
3500 setbufvar(bufnr('%'), '&ft', 'filetype') |
ce7d6b461660
patch 8.2.2284: Vim9: cannot set an option to a boolean value
Bram Moolenaar <Bram@vim.org>
parents:
23458
diff
changeset
|
3501 &ft->assert_equal('filetype') |
ce7d6b461660
patch 8.2.2284: Vim9: cannot set an option to a boolean value
Bram Moolenaar <Bram@vim.org>
parents:
23458
diff
changeset
|
3502 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3503 settabwinvar(1, 1, '&syntax', 'vam') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3504 &syntax->assert_equal('vam') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3505 settabwinvar(1, 1, '&ts', 15) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3506 &ts->assert_equal(15) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3507 setlocal ts=8 |
23485
198ad7ef2420
patch 8.2.2285: Vim9: cannot set an option to a false
Bram Moolenaar <Bram@vim.org>
parents:
23483
diff
changeset
|
3508 settabwinvar(1, 1, '&list', false) |
198ad7ef2420
patch 8.2.2285: Vim9: cannot set an option to a false
Bram Moolenaar <Bram@vim.org>
parents:
23483
diff
changeset
|
3509 &list->assert_equal(false) |
23483
ce7d6b461660
patch 8.2.2284: Vim9: cannot set an option to a boolean value
Bram Moolenaar <Bram@vim.org>
parents:
23458
diff
changeset
|
3510 settabwinvar(1, 1, '&list', true) |
ce7d6b461660
patch 8.2.2284: Vim9: cannot set an option to a boolean value
Bram Moolenaar <Bram@vim.org>
parents:
23458
diff
changeset
|
3511 &list->assert_equal(true) |
ce7d6b461660
patch 8.2.2284: Vim9: cannot set an option to a boolean value
Bram Moolenaar <Bram@vim.org>
parents:
23458
diff
changeset
|
3512 setlocal list& |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3513 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3514 setbufvar('%', 'myvar', 123) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3515 getbufvar('%', 'myvar')->assert_equal(123) |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
3516 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3517 v9.CheckDefAndScriptFailure(['setbufvar(true, "v", 3)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3518 v9.CheckDefAndScriptFailure(['setbufvar(1, 2, 3)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3519 assert_fails('setbufvar("%", "", 10)', 'E461: Illegal variable name') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3520 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3521 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3522 def Test_setbufline() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3523 new |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3524 var bnum = bufnr('%') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3525 :wincmd w |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3526 setbufline(bnum, 1, range(1, 3)) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3527 setbufline(bnum, 4, 'one') |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3528 setbufline(bnum, 5, 10) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3529 setbufline(bnum, 6, ['two', 11]) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3530 assert_equal(['1', '2', '3', 'one', '10', 'two', '11'], getbufline(bnum, 1, '$')) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3531 v9.CheckDefAndScriptFailure(['setbufline([1], 1, "x")'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3532 v9.CheckDefAndScriptFailure(['setbufline(1, [1], "x")'], ['E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3533 v9.CheckDefExecAndScriptFailure(['setbufline(' .. bnum .. ', -1, "x")'], 'E966: Invalid line number: -1') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3534 v9.CheckDefAndScriptFailure(['setbufline(1, 1, {"a": 10})'], ['E1013: Argument 3: type mismatch, expected string but got dict<number>', 'E1224: String, Number or List required for argument 3']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3535 bnum->bufwinid()->win_gotoid() |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
3536 setbufline('', 1, 'nombres') |
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
3537 getline(1)->assert_equal('nombres') |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3538 bw! |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3539 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3540 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3541 def Test_setcellwidths() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3542 v9.CheckDefAndScriptFailure(['setcellwidths(1)'], ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3543 v9.CheckDefAndScriptFailure(['setcellwidths({"a": 10})'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E1211: List required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3544 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3545 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3546 def Test_setcharpos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3547 v9.CheckDefAndScriptFailure(['setcharpos(1, [])'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3548 v9.CheckDefFailure(['setcharpos(".", ["a"])'], 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3549 v9.CheckDefAndScriptFailure(['setcharpos(".", 1)'], ['E1013: Argument 2: type mismatch, expected list<number> but got number', 'E1211: List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3550 v9.CheckDefExecAndScriptFailure(['setcharpos("", [0, 1, 1, 1])'], 'E474: Invalid argument') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3551 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3552 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3553 def Test_setcharsearch() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3554 v9.CheckDefAndScriptFailure(['setcharsearch("x")'], ['E1013: Argument 1: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3555 v9.CheckDefAndScriptFailure(['setcharsearch([])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3556 var d: dict<any> = {char: 'x', forward: 1, until: 1} |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3557 setcharsearch(d) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3558 assert_equal(d, getcharsearch()) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3559 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3560 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3561 def Test_setcmdpos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3562 v9.CheckDefAndScriptFailure(['setcmdpos("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3563 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3564 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3565 def Test_setcursorcharpos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3566 v9.CheckDefAndScriptFailure(['setcursorcharpos(0z10, 1)'], ['E1013: Argument 1: type mismatch, expected number but got blob', 'E1224: String, Number or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3567 v9.CheckDefAndScriptFailure(['setcursorcharpos(1, "2")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3568 v9.CheckDefAndScriptFailure(['setcursorcharpos(1, 2, "3")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3569 v9.CheckDefExecAndScriptFailure(['setcursorcharpos("", 10)'], 'E1209: Invalid value for a line number') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3570 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3571 |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
3572 def Test_setenv() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3573 v9.CheckDefAndScriptFailure(['setenv(1, 2)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3574 assert_equal(0, setenv('', '')) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3575 assert_equal(0, setenv('', v:null)) |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
3576 enddef |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25366
diff
changeset
|
3577 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3578 def Test_setfperm() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3579 v9.CheckDefAndScriptFailure(['setfperm(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3580 v9.CheckDefAndScriptFailure(['setfperm("a", 0z10)'], ['E1013: Argument 2: type mismatch, expected string but got blob', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3581 v9.CheckDefExecAndScriptFailure(['setfperm("Xfile", "")'], 'E475: Invalid argument') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3582 v9.CheckDefExecAndScriptFailure(['setfperm("", "")'], 'E475: Invalid argument') |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3583 assert_equal(0, setfperm('', 'rw-r--r--')) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3584 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3585 |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3586 def Test_setline() |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3587 new |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3588 setline(1, range(1, 4)) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3589 assert_equal(['1', '2', '3', '4'], getline(1, '$')) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3590 setline(1, ['a', 'b', 'c', 'd']) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3591 assert_equal(['a', 'b', 'c', 'd'], getline(1, '$')) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3592 setline(1, 'one') |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3593 assert_equal(['one', 'b', 'c', 'd'], getline(1, '$')) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3594 setline(1, 10) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3595 assert_equal(['10', 'b', 'c', 'd'], getline(1, '$')) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3596 v9.CheckDefAndScriptFailure(['setline([1], "x")'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3597 v9.CheckDefExecAndScriptFailure(['setline("", "x")'], 'E1209: Invalid value for a line number') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3598 v9.CheckDefExecAndScriptFailure(['setline(-1, "x")'], 'E966: Invalid line number: -1') |
26782
b7b82279426f
patch 8.2.3919: Vim9: wrong argument for append() results in two errors
Bram Moolenaar <Bram@vim.org>
parents:
26775
diff
changeset
|
3599 assert_fails('setline(".a", "x")', ['E1209:', 'E1209:']) |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3600 bw! |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3601 enddef |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
3602 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3603 def Test_setloclist() |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
3604 var items = [{filename: '/tmp/file', lnum: 1, valid: true}] |
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
3605 var what = {items: items} |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3606 setqflist([], ' ', what) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3607 setloclist(0, [], ' ', what) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3608 v9.CheckDefAndScriptFailure(['setloclist("1", [])'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3609 v9.CheckDefAndScriptFailure(['setloclist(1, 2)'], ['E1013: Argument 2: type mismatch, expected list<any> but got number', 'E1211: List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3610 v9.CheckDefAndScriptFailure(['setloclist(1, [], 3)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3611 v9.CheckDefAndScriptFailure(['setloclist(1, [], "a", [])'], ['E1013: Argument 4: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 4']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3612 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3613 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3614 def Test_setmatches() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3615 v9.CheckDefAndScriptFailure(['setmatches({})'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<unknown>', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3616 v9.CheckDefAndScriptFailure(['setmatches([], "1")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3617 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3618 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3619 def Test_setpos() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3620 v9.CheckDefAndScriptFailure(['setpos(1, [])'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3621 v9.CheckDefFailure(['setpos(".", ["a"])'], 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3622 v9.CheckDefAndScriptFailure(['setpos(".", 1)'], ['E1013: Argument 2: type mismatch, expected list<number> but got number', 'E1211: List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3623 v9.CheckDefExecAndScriptFailure(['setpos("", [0, 1, 1, 1])'], 'E474: Invalid argument') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3624 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3625 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3626 def Test_setqflist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3627 v9.CheckDefAndScriptFailure(['setqflist(1, "")'], ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3628 v9.CheckDefAndScriptFailure(['setqflist([], 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3629 v9.CheckDefAndScriptFailure(['setqflist([], "", [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3630 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3631 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3632 def Test_setreg() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3633 setreg('a', ['aaa', 'bbb', 'ccc']) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3634 var reginfo = getreginfo('a') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3635 setreg('a', reginfo) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3636 getreginfo('a')->assert_equal(reginfo) |
23909
5db7d275543c
patch 8.2.2497: no error when using more than one character for a register
Bram Moolenaar <Bram@vim.org>
parents:
23875
diff
changeset
|
3637 assert_fails('setreg("ab", 0)', 'E1162:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3638 v9.CheckDefAndScriptFailure(['setreg(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3639 v9.CheckDefAndScriptFailure(['setreg("a", "b", 3)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3640 setreg('', '1a2b3c') |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3641 assert_equal('1a2b3c', @") |
25525
8880eb140a00
patch 8.2.3299: Vim9: exists() does not handle much at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25479
diff
changeset
|
3642 enddef |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3643 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3644 def Test_settabvar() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3645 v9.CheckDefAndScriptFailure(['settabvar("a", "b", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3646 v9.CheckDefAndScriptFailure(['settabvar(1, 2, "c")'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3647 assert_fails('settabvar(1, "", 10)', 'E461: Illegal variable name') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3648 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3649 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3650 def Test_settabwinvar() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3651 v9.CheckDefAndScriptFailure(['settabwinvar("a", 2, "c", true)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3652 v9.CheckDefAndScriptFailure(['settabwinvar(1, "b", "c", [])'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3653 v9.CheckDefAndScriptFailure(['settabwinvar(1, 1, 3, {})'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3654 assert_fails('settabwinvar(1, 1, "", 10)', 'E461: Illegal variable name') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3655 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3656 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3657 def Test_settagstack() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3658 v9.CheckDefAndScriptFailure(['settagstack(true, {})'], ['E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3659 v9.CheckDefAndScriptFailure(['settagstack(1, [1])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3660 v9.CheckDefAndScriptFailure(['settagstack(1, {}, 2)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3661 assert_fails('settagstack(1, {}, "")', 'E962: Invalid action') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3662 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3663 |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3664 def Test_setwinvar() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3665 v9.CheckDefAndScriptFailure(['setwinvar("a", "b", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3666 v9.CheckDefAndScriptFailure(['setwinvar(1, 2, "c")'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3667 assert_fails('setwinvar(1, "", 10)', 'E461: Illegal variable name') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3668 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3669 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3670 def Test_sha256() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3671 v9.CheckDefAndScriptFailure(['sha256(100)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3672 v9.CheckDefAndScriptFailure(['sha256(0zABCD)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3673 assert_equal('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad', sha256('abc')) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3674 assert_equal('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', sha256('')) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3675 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3676 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3677 def Test_shiftwidth() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3678 v9.CheckDefAndScriptFailure(['shiftwidth("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3679 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3680 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3681 def Test_sign_define() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3682 v9.CheckDefAndScriptFailure(['sign_define({"a": 10})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3683 v9.CheckDefAndScriptFailure(['sign_define({"a": 10}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3684 v9.CheckDefAndScriptFailure(['sign_define("a", ["b"])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E1206: Dictionary required for argument 2']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3685 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3686 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3687 def Test_sign_getdefined() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3688 v9.CheckDefAndScriptFailure(['sign_getdefined(["x"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3689 v9.CheckDefAndScriptFailure(['sign_getdefined(2)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3690 sign_getdefined('')->assert_equal([]) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3691 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3692 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3693 def Test_sign_getplaced() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3694 v9.CheckDefAndScriptFailure(['sign_getplaced(["x"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3695 v9.CheckDefAndScriptFailure(['sign_getplaced(1, ["a"])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E1206: Dictionary required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3696 v9.CheckDefAndScriptFailure(['sign_getplaced("a", 1.1)'], ['E1013: Argument 2: type mismatch, expected dict<any> but got float', 'E1206: Dictionary required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3697 v9.CheckDefExecAndScriptFailure(['sign_getplaced(bufnr(), {lnum: ""})'], 'E1030: Using a String as a Number:') |
25850
6f615b2fdc66
patch 8.2.3459: Vim9: need more tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25844
diff
changeset
|
3698 sign_getplaced('')->assert_equal([{signs: [], bufnr: bufnr()}]) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3699 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3700 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3701 def Test_sign_jump() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3702 v9.CheckDefAndScriptFailure(['sign_jump("a", "b", "c")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3703 v9.CheckDefAndScriptFailure(['sign_jump(1, 2, 3)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3704 v9.CheckDefAndScriptFailure(['sign_jump(1, "b", true)'], ['E1013: Argument 3: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 3']) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3705 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3706 |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3707 def Test_sign_place() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3708 v9.CheckDefAndScriptFailure(['sign_place("a", "b", "c", "d")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3709 v9.CheckDefAndScriptFailure(['sign_place(1, 2, "c", "d")'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3710 v9.CheckDefAndScriptFailure(['sign_place(1, "b", 3, "d")'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3711 v9.CheckDefAndScriptFailure(['sign_place(1, "b", "c", 1.1)'], ['E1013: Argument 4: type mismatch, expected string but got float', 'E1220: String or Number required for argument 4']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3712 v9.CheckDefAndScriptFailure(['sign_place(1, "b", "c", "d", [1])'], ['E1013: Argument 5: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 5']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3713 v9.CheckDefExecAndScriptFailure(['sign_place(0, "", "MySign", bufnr(), {lnum: ""})'], 'E1209: Invalid value for a line number: ""') |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3714 assert_fails("sign_place(0, '', '', '')", 'E155:') |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3715 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
3716 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3717 def Test_sign_placelist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3718 v9.CheckDefAndScriptFailure(['sign_placelist("x")'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3719 v9.CheckDefAndScriptFailure(['sign_placelist({"a": 10})'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3720 v9.CheckDefExecAndScriptFailure(['sign_placelist([{"name": "MySign", "buffer": bufnr(), "lnum": ""}])'], 'E1209: Invalid value for a line number: ""') |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26089
diff
changeset
|
3721 assert_fails('sign_placelist([{name: "MySign", buffer: "", lnum: 1}])', 'E155:') |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3722 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3723 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3724 def Test_sign_undefine() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3725 v9.CheckDefAndScriptFailure(['sign_undefine({})'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3726 v9.CheckDefAndScriptFailure(['sign_undefine([1])'], ['E1013: Argument 1: type mismatch, expected list<string> but got list<number>', 'E155: Unknown sign:']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3727 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3728 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3729 def Test_sign_unplace() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3730 v9.CheckDefAndScriptFailure(['sign_unplace({"a": 10})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3731 v9.CheckDefAndScriptFailure(['sign_unplace({"a": 10}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3732 v9.CheckDefAndScriptFailure(['sign_unplace("a", ["b"])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E1206: Dictionary required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3733 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
3734 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3735 def Test_sign_unplacelist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3736 v9.CheckDefAndScriptFailure(['sign_unplacelist("x")'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3737 v9.CheckDefAndScriptFailure(['sign_unplacelist({"a": 10})'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E1211: List required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3738 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3739 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3740 def Test_simplify() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3741 v9.CheckDefAndScriptFailure(['simplify(100)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3742 call assert_equal('NonExistingFile', simplify('NonExistingFile')) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3743 simplify('')->assert_equal('') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3744 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3745 |
23604
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3746 def Test_slice() |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3747 assert_equal('12345', slice('012345', 1)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3748 assert_equal('123', slice('012345', 1, 4)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3749 assert_equal('1234', slice('012345', 1, -1)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3750 assert_equal('1', slice('012345', 1, -4)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3751 assert_equal('', slice('012345', 1, -5)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3752 assert_equal('', slice('012345', 1, -6)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3753 |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3754 assert_equal([1, 2, 3, 4, 5], slice(range(6), 1)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3755 assert_equal([1, 2, 3], slice(range(6), 1, 4)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3756 assert_equal([1, 2, 3, 4], slice(range(6), 1, -1)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3757 assert_equal([1], slice(range(6), 1, -4)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3758 assert_equal([], slice(range(6), 1, -5)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3759 assert_equal([], slice(range(6), 1, -6)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3760 |
27555
829aec0d0387
patch 8.2.4304: Vim9: slice() makes a copy but doesn't change the type
Bram Moolenaar <Bram@vim.org>
parents:
27551
diff
changeset
|
3761 var lds: list<dict<string>> = [{key: 'value'}] |
829aec0d0387
patch 8.2.4304: Vim9: slice() makes a copy but doesn't change the type
Bram Moolenaar <Bram@vim.org>
parents:
27551
diff
changeset
|
3762 assert_equal(['val'], lds->slice(0, 1)->map((_, v) => 'val')) |
27573
68eac9355e49
patch 8.2.4313: Vim9: cannot change type of list after making a slice
Bram Moolenaar <Bram@vim.org>
parents:
27567
diff
changeset
|
3763 assert_equal(['val'], lds[ : ]->map((_, v) => 'val')) |
27555
829aec0d0387
patch 8.2.4304: Vim9: slice() makes a copy but doesn't change the type
Bram Moolenaar <Bram@vim.org>
parents:
27551
diff
changeset
|
3764 |
23604
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3765 assert_equal(0z1122334455, slice(0z001122334455, 1)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3766 assert_equal(0z112233, slice(0z001122334455, 1, 4)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3767 assert_equal(0z11223344, slice(0z001122334455, 1, -1)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3768 assert_equal(0z11, slice(0z001122334455, 1, -4)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3769 assert_equal(0z, slice(0z001122334455, 1, -5)) |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3770 assert_equal(0z, slice(0z001122334455, 1, -6)) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3771 v9.CheckDefAndScriptFailure(['slice({"a": 10}, 1)'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3772 v9.CheckDefAndScriptFailure(['slice([1, 2, 3], "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3773 v9.CheckDefAndScriptFailure(['slice("abc", 1, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
23604
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3774 enddef |
1816ea68c022
patch 8.2.2344: using inclusive index for slice is not always desired
Bram Moolenaar <Bram@vim.org>
parents:
23602
diff
changeset
|
3775 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3776 def Test_spellsuggest() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3777 if !has('spell') |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
3778 CheckFeature spell |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3779 else |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3780 spellsuggest('marrch', 1, true)->assert_equal(['March']) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3781 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3782 v9.CheckDefAndScriptFailure(['spellsuggest(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3783 v9.CheckDefAndScriptFailure(['spellsuggest("a", "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3784 v9.CheckDefAndScriptFailure(['spellsuggest("a", 1, 0z01)'], ['E1013: Argument 3: type mismatch, expected bool but got blob', 'E1212: Bool required for argument 3']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
3785 spellsuggest('')->assert_equal([]) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3786 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3787 |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3788 def Test_sound_playevent() |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3789 CheckFeature sound |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3790 v9.CheckDefAndScriptFailure(['sound_playevent(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3791 enddef |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3792 |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3793 def Test_sound_playfile() |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3794 CheckFeature sound |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3795 v9.CheckDefAndScriptFailure(['sound_playfile(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3796 enddef |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
3797 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3798 def Test_sound_stop() |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3799 CheckFeature sound |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3800 v9.CheckDefAndScriptFailure(['sound_stop("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3801 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3802 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3803 def Test_soundfold() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3804 v9.CheckDefAndScriptFailure(['soundfold(20)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3805 assert_equal('abc', soundfold('abc')) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3806 assert_equal('', soundfold('')) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3807 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3808 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3809 def Test_sort_return_type() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3810 var res: list<number> |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3811 res = [1, 2, 3]->sort() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3812 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3813 |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3814 def Test_sort_argument() |
23104
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3815 var lines =<< trim END |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3816 var res = ['b', 'a', 'c']->sort('i') |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3817 res->assert_equal(['a', 'b', 'c']) |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3818 |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3819 def Compare(a: number, b: number): number |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3820 return a - b |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3821 enddef |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3822 var l = [3, 6, 7, 1, 8, 2, 4, 5] |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3823 sort(l, Compare) |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3824 assert_equal([1, 2, 3, 4, 5, 6, 7, 8], l) |
1013a97d5dc0
patch 8.2.2098: Vim9: function argument of sort() and map() not tested
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3825 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3826 v9.CheckDefAndScriptSuccess(lines) |
27847
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3827 |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3828 lines =<< trim END |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3829 sort([1, 2, 3], (a: any, b: any) => 1) |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3830 END |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3831 v9.CheckDefAndScriptSuccess(lines) |
27867
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3832 |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3833 lines =<< trim END |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3834 vim9script |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3835 def SortedList(): list<number> |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3836 var Lambda: func: number = (a, b): number => a - b |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3837 var l = [3, 2, 1] |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3838 return l->sort(Lambda) |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3839 enddef |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3840 SortedList()->assert_equal([1, 2, 3]) |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3841 END |
1b75d767d9e4
patch 8.2.4459: Vim9: compiling sort() call fails with unknown arguments
Bram Moolenaar <Bram@vim.org>
parents:
27865
diff
changeset
|
3842 v9.CheckScriptSuccess(lines) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3843 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3844 |
26763
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3845 def Test_sort_compare_func_fails() |
27847
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3846 v9.CheckDefAndScriptFailure(['sort("a")'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1']) |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3847 v9.CheckDefAndScriptFailure(['sort([1], "", [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3848 |
26763
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3849 var lines =<< trim END |
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3850 vim9script |
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3851 echo ['a', 'b', 'c']->sort((a: number, b: number) => 0) |
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3852 END |
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3853 writefile(lines, 'Xbadsort') |
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3854 assert_fails('source Xbadsort', ['E1013:', 'E702:']) |
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3855 delete('Xbadsort') |
27847
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3856 |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3857 lines =<< trim END |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3858 var l = [1, 2, 3] |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3859 sort(l, (a: string, b: number) => 1) |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3860 END |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3861 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?number): number but got func(string, number): number', 'E1013: Argument 1: type mismatch, expected string but got number']) |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3862 |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3863 lines =<< trim END |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3864 var l = ['a', 'b', 'c'] |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3865 sort(l, (a: string, b: number) => 1) |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3866 END |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3867 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?string, ?string): number but got func(string, number): number', 'E1013: Argument 2: type mismatch, expected number but got string']) |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3868 |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3869 lines =<< trim END |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3870 sort([1, 2, 3], (a: number, b: number) => true) |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3871 END |
780818e65dff
patch 8.2.4449: vim9: function argument of sort() not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
27841
diff
changeset
|
3872 v9.CheckDefAndScriptFailure(lines, ['E1013: Argument 2: type mismatch, expected func(?number, ?number): number but got func(number, number): bool', 'E1138: Using a Bool as a Number']) |
26763
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3873 enddef |
9cb27a68a01b
patch 8.2.3910: when compare function of sort() fails it does not abort
Bram Moolenaar <Bram@vim.org>
parents:
26751
diff
changeset
|
3874 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3875 def Test_spellbadword() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3876 v9.CheckDefAndScriptFailure(['spellbadword(100)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3877 spellbadword('good')->assert_equal(['', '']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3878 spellbadword('')->assert_equal(['', '']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3879 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3880 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3881 def Test_split() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3882 split(' aa bb ', '\W\+', true)->assert_equal(['', 'aa', 'bb', '']) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3883 v9.CheckDefAndScriptFailure(['split(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3884 v9.CheckDefAndScriptFailure(['split("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3885 v9.CheckDefAndScriptFailure(['split("a", "b", 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3886 split('')->assert_equal([]) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
3887 split('', '')->assert_equal([]) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3888 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3889 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3890 def Test_srand() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3891 var expected = srand()->len()->range()->map((_, _) => 'x') |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3892 assert_equal(expected, srand()->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3893 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3894 v9.CheckDefAndScriptFailure(['srand("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3895 type(srand(100))->assert_equal(v:t_list) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3896 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3897 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3898 def Test_state() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3899 v9.CheckDefAndScriptFailure(['state({})'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3900 assert_equal('', state('a')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3901 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3902 |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3903 def Test_str2float() |
23804
007fa6365dfb
patch 8.2.2443: Vim9: no compile time error for wrong str2float argument
Bram Moolenaar <Bram@vim.org>
parents:
23800
diff
changeset
|
3904 if !has('float') |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
3905 CheckFeature float |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3906 else |
23804
007fa6365dfb
patch 8.2.2443: Vim9: no compile time error for wrong str2float argument
Bram Moolenaar <Bram@vim.org>
parents:
23800
diff
changeset
|
3907 str2float("1.00")->assert_equal(1.00) |
007fa6365dfb
patch 8.2.2443: Vim9: no compile time error for wrong str2float argument
Bram Moolenaar <Bram@vim.org>
parents:
23800
diff
changeset
|
3908 str2float("2e-2")->assert_equal(0.02) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3909 str2float('')->assert_equal(0.0) |
23804
007fa6365dfb
patch 8.2.2443: Vim9: no compile time error for wrong str2float argument
Bram Moolenaar <Bram@vim.org>
parents:
23800
diff
changeset
|
3910 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3911 v9.CheckDefAndScriptFailure(['str2float(123)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
23804
007fa6365dfb
patch 8.2.2443: Vim9: no compile time error for wrong str2float argument
Bram Moolenaar <Bram@vim.org>
parents:
23800
diff
changeset
|
3912 endif |
007fa6365dfb
patch 8.2.2443: Vim9: no compile time error for wrong str2float argument
Bram Moolenaar <Bram@vim.org>
parents:
23800
diff
changeset
|
3913 enddef |
007fa6365dfb
patch 8.2.2443: Vim9: no compile time error for wrong str2float argument
Bram Moolenaar <Bram@vim.org>
parents:
23800
diff
changeset
|
3914 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
3915 def Test_str2list() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3916 assert_equal(['x', 'x', 'x'], str2list('abc')->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
3917 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3918 v9.CheckDefAndScriptFailure(['str2list(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3919 v9.CheckDefAndScriptFailure(['str2list("a", 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
3920 assert_equal([97], str2list('a')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
3921 assert_equal([97], str2list('a', 1)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
3922 assert_equal([97], str2list('a', true)) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3923 str2list('')->assert_equal([]) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
3924 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
3925 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3926 def Test_str2nr() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3927 str2nr("1'000'000", 10, true)->assert_equal(1000000) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3928 str2nr('')->assert_equal(0) |
23786
0512923e54e1
patch 8.2.2434: Vim9: no error when compiling str2nr() with a number
Bram Moolenaar <Bram@vim.org>
parents:
23705
diff
changeset
|
3929 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3930 v9.CheckDefAndScriptFailure(['str2nr(123)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3931 v9.CheckDefAndScriptFailure(['str2nr("123", "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3932 v9.CheckDefAndScriptFailure(['str2nr("123", 10, "x")'], ['E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3933 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3934 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3935 def Test_strcharlen() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3936 v9.CheckDefAndScriptFailure(['strcharlen([1])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3937 "abc"->strcharlen()->assert_equal(3) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3938 strcharlen(99)->assert_equal(2) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3939 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3940 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3941 def Test_strcharpart() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3942 v9.CheckDefAndScriptFailure(['strcharpart(1, 2)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3943 v9.CheckDefAndScriptFailure(['strcharpart("a", "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3944 v9.CheckDefAndScriptFailure(['strcharpart("a", 1, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3945 v9.CheckDefAndScriptFailure(['strcharpart("a", 1, 1, 2)'], ['E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3946 strcharpart('', 0)->assert_equal('') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3947 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3948 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3949 def Test_strchars() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3950 strchars("A\u20dd", true)->assert_equal(1) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3951 v9.CheckDefAndScriptFailure(['strchars(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3952 v9.CheckDefAndScriptFailure(['strchars("a", 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
3953 assert_equal(3, strchars('abc')) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
3954 assert_equal(3, strchars('abc', 1)) |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
3955 assert_equal(3, strchars('abc', true)) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3956 strchars('')->assert_equal(0) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3957 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3958 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3959 def Test_strdisplaywidth() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3960 v9.CheckDefAndScriptFailure(['strdisplaywidth(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3961 v9.CheckDefAndScriptFailure(['strdisplaywidth("a", "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3962 strdisplaywidth('')->assert_equal(0) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3963 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3964 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3965 def Test_strftime() |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3966 if exists('*strftime') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3967 v9.CheckDefAndScriptFailure(['strftime(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3968 v9.CheckDefAndScriptFailure(['strftime("a", "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3969 strftime('')->assert_equal('') |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3970 endif |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3971 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3972 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3973 def Test_strgetchar() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3974 v9.CheckDefAndScriptFailure(['strgetchar(1, 1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3975 v9.CheckDefAndScriptFailure(['strgetchar("a", "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3976 strgetchar('', 0)->assert_equal(-1) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3977 strgetchar('', 1)->assert_equal(-1) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3978 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
3979 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3980 def Test_stridx() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3981 v9.CheckDefAndScriptFailure(['stridx([1], "b")'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3982 v9.CheckDefAndScriptFailure(['stridx("a", {})'], ['E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3983 v9.CheckDefAndScriptFailure(['stridx("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3984 stridx('', '')->assert_equal(0) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3985 stridx('', 'a')->assert_equal(-1) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
3986 stridx('a', '')->assert_equal(0) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3987 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
3988 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3989 def Test_strlen() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3990 v9.CheckDefAndScriptFailure(['strlen([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3991 "abc"->strlen()->assert_equal(3) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3992 strlen(99)->assert_equal(2) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3993 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
3994 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
3995 def Test_strpart() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3996 v9.CheckDefAndScriptFailure(['strpart(1, 2)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3997 v9.CheckDefAndScriptFailure(['strpart("a", "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3998 v9.CheckDefAndScriptFailure(['strpart("a", 1, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
3999 v9.CheckDefAndScriptFailure(['strpart("a", 1, 1, 2)'], ['E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4000 strpart('', 0)->assert_equal('') |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4001 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4002 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4003 def Test_strptime() |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4004 CheckFunction strptime |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4005 if exists_compiled('*strptime') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4006 v9.CheckDefAndScriptFailure(['strptime(10, "2021")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4007 v9.CheckDefAndScriptFailure(['strptime("%Y", 2021)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4008 assert_true(strptime('%Y', '2021') != 0) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4009 assert_true(strptime('%Y', '') == 0) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4010 endif |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4011 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4012 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4013 def Test_strridx() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4014 v9.CheckDefAndScriptFailure(['strridx([1], "b")'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4015 v9.CheckDefAndScriptFailure(['strridx("a", {})'], ['E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4016 v9.CheckDefAndScriptFailure(['strridx("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4017 strridx('', '')->assert_equal(0) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4018 strridx('', 'a')->assert_equal(-1) |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4019 strridx('a', '')->assert_equal(1) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4020 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4021 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4022 def Test_strtrans() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4023 v9.CheckDefAndScriptFailure(['strtrans(20)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4024 assert_equal('abc', strtrans('abc')) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4025 strtrans('')->assert_equal('') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4026 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4027 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4028 def Test_strwidth() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4029 v9.CheckDefAndScriptFailure(['strwidth(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4030 assert_equal(4, strwidth('abcd')) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4031 strwidth('')->assert_equal(0) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4032 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4033 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4034 def Test_submatch() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4035 var pat = 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)' |
23565
34aa2907082a
patch 8.2.2325: Vim9: crash if map() changes the item type
Bram Moolenaar <Bram@vim.org>
parents:
23535
diff
changeset
|
4036 var Rep = () => range(10)->mapnew((_, v) => submatch(v, true))->string() |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4037 var actual = substitute('A123456789', pat, Rep, '') |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4038 var expected = "[['A123456789'], ['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']]" |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4039 actual->assert_equal(expected) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4040 v9.CheckDefAndScriptFailure(['submatch("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4041 v9.CheckDefAndScriptFailure(['submatch(1, "a")'], ['E1013: Argument 2: type mismatch, expected bool but got string', 'E1212: Bool required for argument 2']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4042 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4043 |
24812
8fdf839af1f4
patch 8.2.2944: Vim9: no error when using job or channel as a string
Bram Moolenaar <Bram@vim.org>
parents:
24808
diff
changeset
|
4044 def Test_substitute() |
8fdf839af1f4
patch 8.2.2944: Vim9: no error when using job or channel as a string
Bram Moolenaar <Bram@vim.org>
parents:
24808
diff
changeset
|
4045 var res = substitute('A1234', '\d', 'X', '') |
8fdf839af1f4
patch 8.2.2944: Vim9: no error when using job or channel as a string
Bram Moolenaar <Bram@vim.org>
parents:
24808
diff
changeset
|
4046 assert_equal('AX234', res) |
8fdf839af1f4
patch 8.2.2944: Vim9: no error when using job or channel as a string
Bram Moolenaar <Bram@vim.org>
parents:
24808
diff
changeset
|
4047 |
8fdf839af1f4
patch 8.2.2944: Vim9: no error when using job or channel as a string
Bram Moolenaar <Bram@vim.org>
parents:
24808
diff
changeset
|
4048 if has('job') |
25411
df8499997fcc
patch 8.2.3242: Vim9: valgrind reports leaks in builtin function test
Bram Moolenaar <Bram@vim.org>
parents:
25390
diff
changeset
|
4049 assert_fails('"text"->substitute(".*", () => test_null_job(), "")', 'E908: using an invalid value as a String: job') |
df8499997fcc
patch 8.2.3242: Vim9: valgrind reports leaks in builtin function test
Bram Moolenaar <Bram@vim.org>
parents:
25390
diff
changeset
|
4050 assert_fails('"text"->substitute(".*", () => test_null_channel(), "")', 'E908: using an invalid value as a String: channel') |
24812
8fdf839af1f4
patch 8.2.2944: Vim9: no error when using job or channel as a string
Bram Moolenaar <Bram@vim.org>
parents:
24808
diff
changeset
|
4051 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4052 v9.CheckDefAndScriptFailure(['substitute(1, "b", "1", "d")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4053 v9.CheckDefAndScriptFailure(['substitute("a", 2, "1", "d")'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4054 v9.CheckDefAndScriptFailure(['substitute("a", "b", "1", 4)'], ['E1013: Argument 4: type mismatch, expected string but got number', 'E1174: String required for argument 4']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
4055 substitute('', '', '', '')->assert_equal('') |
24812
8fdf839af1f4
patch 8.2.2944: Vim9: no error when using job or channel as a string
Bram Moolenaar <Bram@vim.org>
parents:
24808
diff
changeset
|
4056 enddef |
8fdf839af1f4
patch 8.2.2944: Vim9: no error when using job or channel as a string
Bram Moolenaar <Bram@vim.org>
parents:
24808
diff
changeset
|
4057 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4058 def Test_swapinfo() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4059 v9.CheckDefAndScriptFailure(['swapinfo({})'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
4060 call swapinfo('x')->assert_equal({error: 'Cannot open file'}) |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
4061 call swapinfo('')->assert_equal({error: 'Cannot open file'}) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4062 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4063 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4064 def Test_swapname() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4065 v9.CheckDefAndScriptFailure(['swapname([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4066 assert_fails('swapname("NonExistingBuf")', 'E94:') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4067 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4068 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4069 def Test_synID() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4070 new |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4071 setline(1, "text") |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4072 synID(1, 1, true)->assert_equal(0) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4073 bwipe! |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4074 v9.CheckDefAndScriptFailure(['synID(0z10, 1, true)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4075 v9.CheckDefAndScriptFailure(['synID("a", true, false)'], ['E1013: Argument 2: type mismatch, expected number but got bool', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4076 v9.CheckDefAndScriptFailure(['synID(1, 1, 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4077 v9.CheckDefExecAndScriptFailure(['synID("", 10, true)'], 'E1209: Invalid value for a line number') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4078 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4079 |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
4080 def Test_synIDattr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4081 v9.CheckDefAndScriptFailure(['synIDattr("a", "b")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4082 v9.CheckDefAndScriptFailure(['synIDattr(1, 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4083 v9.CheckDefAndScriptFailure(['synIDattr(1, "b", 3)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
4084 synIDattr(1, '', '')->assert_equal('') |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
4085 enddef |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
4086 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4087 def Test_synIDtrans() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4088 v9.CheckDefAndScriptFailure(['synIDtrans("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4089 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4090 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4091 def Test_synconcealed() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4092 v9.CheckDefAndScriptFailure(['synconcealed(0z10, 1)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4093 v9.CheckDefAndScriptFailure(['synconcealed(1, "a")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
4094 if has('conceal') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4095 v9.CheckDefExecAndScriptFailure(['synconcealed("", 4)'], 'E1209: Invalid value for a line number') |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
4096 endif |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4097 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4098 |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4099 def Test_synstack() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4100 v9.CheckDefAndScriptFailure(['synstack(0z10, 1)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4101 v9.CheckDefAndScriptFailure(['synstack(1, "a")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4102 v9.CheckDefExecAndScriptFailure(['synstack("", 4)'], 'E1209: Invalid value for a line number') |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4103 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4104 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4105 def Test_system() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4106 v9.CheckDefAndScriptFailure(['system(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4107 v9.CheckDefAndScriptFailure(['system("a", {})'], ['E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1224: String, Number or List required for argument 2']) |
25390
a6c347a0c6e3
patch 8.2.3232: system() does not work without a second argument
Bram Moolenaar <Bram@vim.org>
parents:
25386
diff
changeset
|
4108 assert_equal("123\n", system('echo 123')) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4109 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4110 |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4111 def Test_systemlist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4112 v9.CheckDefAndScriptFailure(['systemlist(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4113 v9.CheckDefAndScriptFailure(['systemlist("a", {})'], ['E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1224: String, Number or List required for argument 2']) |
25390
a6c347a0c6e3
patch 8.2.3232: system() does not work without a second argument
Bram Moolenaar <Bram@vim.org>
parents:
25386
diff
changeset
|
4114 if has('win32') |
a6c347a0c6e3
patch 8.2.3232: system() does not work without a second argument
Bram Moolenaar <Bram@vim.org>
parents:
25386
diff
changeset
|
4115 call assert_equal(["123\r"], systemlist('echo 123')) |
a6c347a0c6e3
patch 8.2.3232: system() does not work without a second argument
Bram Moolenaar <Bram@vim.org>
parents:
25386
diff
changeset
|
4116 else |
a6c347a0c6e3
patch 8.2.3232: system() does not work without a second argument
Bram Moolenaar <Bram@vim.org>
parents:
25386
diff
changeset
|
4117 call assert_equal(['123'], systemlist('echo 123')) |
a6c347a0c6e3
patch 8.2.3232: system() does not work without a second argument
Bram Moolenaar <Bram@vim.org>
parents:
25386
diff
changeset
|
4118 endif |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4119 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4120 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4121 def Test_tabpagebuflist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4122 v9.CheckDefAndScriptFailure(['tabpagebuflist("t")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4123 assert_equal([bufnr('')], tabpagebuflist()) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4124 assert_equal([bufnr('')], tabpagebuflist(1)) |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
4125 assert_equal(['x'], tabpagebuflist()->map((_, _) => 'x')) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4126 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4127 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4128 def Test_tabpagenr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4129 v9.CheckDefAndScriptFailure(['tabpagenr(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4130 v9.CheckDefExecAndScriptFailure(['tabpagenr("")'], 'E15: Invalid expression') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4131 assert_equal(1, tabpagenr('$')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4132 assert_equal(1, tabpagenr()) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4133 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4134 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4135 def Test_tabpagewinnr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4136 v9.CheckDefAndScriptFailure(['tabpagewinnr("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4137 v9.CheckDefAndScriptFailure(['tabpagewinnr(1, 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4138 v9.CheckDefExecAndScriptFailure(['tabpagewinnr(1, "")'], 'E15: Invalid expression') |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4139 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4140 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4141 def Test_taglist() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4142 v9.CheckDefAndScriptFailure(['taglist([1])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4143 v9.CheckDefAndScriptFailure(['taglist("a", [2])'], ['E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2']) |
25844
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
4144 taglist('')->assert_equal(0) |
29bbe650f2a1
patch 8.2.3456: Vim9: not all functions are tested with empty string argument
Bram Moolenaar <Bram@vim.org>
parents:
25822
diff
changeset
|
4145 taglist('', '')->assert_equal(0) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4146 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4147 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4148 def Test_term_dumpload() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4149 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4150 v9.CheckDefAndScriptFailure(['term_dumpload({"a": 10})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4151 v9.CheckDefAndScriptFailure(['term_dumpload({"a": 10}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4152 v9.CheckDefAndScriptFailure(['term_dumpload("a", ["b"])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E1206: Dictionary required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4153 v9.CheckDefExecAndScriptFailure(['term_dumpload("")'], 'E485: Can''t read file') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4154 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4155 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4156 def Test_term_dumpdiff() |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4157 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4158 v9.CheckDefAndScriptFailure(['term_dumpdiff(1, "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4159 v9.CheckDefAndScriptFailure(['term_dumpdiff("a", 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4160 v9.CheckDefAndScriptFailure(['term_dumpdiff("a", "b", [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4161 v9.CheckDefExecAndScriptFailure(['term_dumpdiff("", "")'], 'E485: Can''t read file') |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4162 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4163 |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4164 def Test_term_dumpwrite() |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4165 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4166 v9.CheckDefAndScriptFailure(['term_dumpwrite(true, "b")'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4167 v9.CheckDefAndScriptFailure(['term_dumpwrite(1, 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4168 v9.CheckDefAndScriptFailure(['term_dumpwrite("a", "b", [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4169 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4170 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4171 def Test_term_getaltscreen() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4172 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4173 v9.CheckDefAndScriptFailure(['term_getaltscreen(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4174 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4175 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4176 def Test_term_getansicolors() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4177 CheckRunVimInTerminal |
25240
a7f2a2079bce
patch 8.2.3156: Vim9: term_getansicolors() test fails without +termguicolors
Bram Moolenaar <Bram@vim.org>
parents:
25236
diff
changeset
|
4178 CheckFeature termguicolors |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4179 v9.CheckDefAndScriptFailure(['term_getansicolors(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1220: String or Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4180 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4181 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4182 def Test_term_getattr() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4183 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4184 v9.CheckDefAndScriptFailure(['term_getattr("x", "a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4185 v9.CheckDefAndScriptFailure(['term_getattr(1, 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4186 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4187 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4188 def Test_term_getcursor() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4189 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4190 v9.CheckDefAndScriptFailure(['term_getcursor({"a": 10})'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1220: String or Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4191 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4192 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4193 def Test_term_getjob() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4194 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4195 v9.CheckDefAndScriptFailure(['term_getjob(0z10)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4196 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4197 |
25314
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4198 def Test_term_getline() |
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4199 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4200 v9.CheckDefAndScriptFailure(['term_getline(1.1, 1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4201 v9.CheckDefAndScriptFailure(['term_getline(1, 1.1)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1220: String or Number required for argument 2']) |
25314
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4202 enddef |
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4203 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4204 def Test_term_getscrolled() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4205 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4206 v9.CheckDefAndScriptFailure(['term_getscrolled(1.1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4207 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4208 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4209 def Test_term_getsize() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4210 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4211 v9.CheckDefAndScriptFailure(['term_getsize(1.1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4212 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4213 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4214 def Test_term_getstatus() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4215 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4216 v9.CheckDefAndScriptFailure(['term_getstatus(1.1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4217 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4218 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4219 def Test_term_gettitle() |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4220 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4221 v9.CheckDefAndScriptFailure(['term_gettitle(1.1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4222 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4223 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4224 def Test_term_gettty() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4225 if !has('terminal') |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
4226 CheckFeature terminal |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4227 else |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4228 var buf = g:Run_shell_in_terminal({}) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4229 term_gettty(buf, true)->assert_notequal('') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4230 g:StopShellInTerminal(buf) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4231 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4232 v9.CheckDefAndScriptFailure(['term_gettty([1])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4233 v9.CheckDefAndScriptFailure(['term_gettty(1, 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4234 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4235 |
25314
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4236 def Test_term_scrape() |
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4237 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4238 v9.CheckDefAndScriptFailure(['term_scrape(1.1, 1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4239 v9.CheckDefAndScriptFailure(['term_scrape(1, 1.1)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1220: String or Number required for argument 2']) |
25314
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4240 enddef |
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4241 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4242 def Test_term_sendkeys() |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4243 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4244 v9.CheckDefAndScriptFailure(['term_sendkeys([], "p")'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4245 v9.CheckDefAndScriptFailure(['term_sendkeys(1, [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4246 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4247 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4248 def Test_term_setansicolors() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4249 CheckRunVimInTerminal |
25366
53340635776e
patch 8.2.3220: Test_term_setansicolors() fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
4250 |
53340635776e
patch 8.2.3220: Test_term_setansicolors() fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
4251 if has('termguicolors') || has('gui') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4252 v9.CheckDefAndScriptFailure(['term_setansicolors([], "p")'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4253 v9.CheckDefAndScriptFailure(['term_setansicolors(10, {})'], ['E1013: Argument 2: type mismatch, expected list<any> but got dict<unknown>', 'E1211: List required for argument 2']) |
25366
53340635776e
patch 8.2.3220: Test_term_setansicolors() fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
4254 else |
53340635776e
patch 8.2.3220: Test_term_setansicolors() fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
4255 throw 'Skipped: Only works with termguicolors or gui feature' |
53340635776e
patch 8.2.3220: Test_term_setansicolors() fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
4256 endif |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4257 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4258 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4259 def Test_term_setapi() |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4260 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4261 v9.CheckDefAndScriptFailure(['term_setapi([], "p")'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4262 v9.CheckDefAndScriptFailure(['term_setapi(1, [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4263 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4264 |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4265 def Test_term_setkill() |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4266 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4267 v9.CheckDefAndScriptFailure(['term_setkill([], "p")'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4268 v9.CheckDefAndScriptFailure(['term_setkill(1, [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4269 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4270 |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4271 def Test_term_setrestore() |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4272 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4273 v9.CheckDefAndScriptFailure(['term_setrestore([], "p")'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4274 v9.CheckDefAndScriptFailure(['term_setrestore(1, [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4275 enddef |
25314
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4276 |
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4277 def Test_term_setsize() |
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4278 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4279 v9.CheckDefAndScriptFailure(['term_setsize(1.1, 2, 3)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4280 v9.CheckDefAndScriptFailure(['term_setsize(1, "2", 3)'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4281 v9.CheckDefAndScriptFailure(['term_setsize(1, 2, "3")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25314
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4282 enddef |
7e620652bd13
patch 8.2.3194: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4283 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4284 def Test_term_start() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4285 if !has('terminal') |
25288
ddc38de331ff
patch 8.2.3181: Vim9: builtin function test fails without channel feature
Bram Moolenaar <Bram@vim.org>
parents:
25272
diff
changeset
|
4286 CheckFeature terminal |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4287 else |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4288 botright new |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4289 var winnr = winnr() |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
4290 term_start(&shell, {curwin: true}) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4291 winnr()->assert_equal(winnr) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4292 bwipe! |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4293 endif |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4294 v9.CheckDefAndScriptFailure(['term_start({})'], ['E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4295 v9.CheckDefAndScriptFailure(['term_start([], [])'], ['E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4296 v9.CheckDefAndScriptFailure(['term_start("", "")'], ['E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4297 v9.CheckDefExecAndScriptFailure(['term_start("")'], 'E474: Invalid argument') |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4298 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4299 |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4300 def Test_term_wait() |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4301 CheckRunVimInTerminal |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4302 v9.CheckDefAndScriptFailure(['term_wait(0z10, 1)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4303 v9.CheckDefAndScriptFailure(['term_wait(1, "a")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25272
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4304 enddef |
712e867f9721
patch 8.2.3173: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25270
diff
changeset
|
4305 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4306 def Test_test_alloc_fail() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4307 v9.CheckDefAndScriptFailure(['test_alloc_fail("a", 10, 20)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4308 v9.CheckDefAndScriptFailure(['test_alloc_fail(10, "b", 20)'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4309 v9.CheckDefAndScriptFailure(['test_alloc_fail(10, 20, "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4310 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4311 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4312 def Test_test_feedinput() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4313 v9.CheckDefAndScriptFailure(['test_feedinput(test_void())'], ['E1013: Argument 1: type mismatch, expected string but got void', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4314 v9.CheckDefAndScriptFailure(['test_feedinput(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4315 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4316 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4317 def Test_test_getvalue() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4318 v9.CheckDefAndScriptFailure(['test_getvalue(1.1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4319 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4320 |
27462
b43f6c879d52
patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
4321 def Test_test_gui_event() |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25348
diff
changeset
|
4322 CheckGui |
27462
b43f6c879d52
patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
4323 v9.CheckDefAndScriptFailure(['test_gui_event([], {})'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1']) |
b43f6c879d52
patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
4324 v9.CheckDefAndScriptFailure(['test_gui_event("abc", 1)'], ['E1013: Argument 2: type mismatch, expected dict<any> but got number', 'E1206: Dictionary required for argument 2']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4325 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4326 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4327 def Test_test_ignore_error() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4328 v9.CheckDefAndScriptFailure(['test_ignore_error([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4329 test_ignore_error('RESET') |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4330 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4331 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4332 def Test_test_option_not_set() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4333 v9.CheckDefAndScriptFailure(['test_option_not_set([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4334 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4335 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4336 def Test_test_override() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4337 v9.CheckDefAndScriptFailure(['test_override(1, 1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4338 v9.CheckDefAndScriptFailure(['test_override("a", "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4339 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4340 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4341 def Test_test_setmouse() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4342 v9.CheckDefAndScriptFailure(['test_setmouse("a", 10)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4343 v9.CheckDefAndScriptFailure(['test_setmouse(10, "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4344 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4345 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4346 def Test_test_settime() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4347 v9.CheckDefAndScriptFailure(['test_settime([1])'], ['E1013: Argument 1: type mismatch, expected number but got list<number>', 'E1210: Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4348 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4349 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4350 def Test_test_srand_seed() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4351 v9.CheckDefAndScriptFailure(['test_srand_seed([1])'], ['E1013: Argument 1: type mismatch, expected number but got list<number>', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4352 v9.CheckDefAndScriptFailure(['test_srand_seed("10")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4353 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4354 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4355 def Test_timer_info() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4356 v9.CheckDefAndScriptFailure(['timer_info("id")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4357 assert_equal([], timer_info(100)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4358 assert_equal([], timer_info()) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4359 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4360 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4361 def Test_timer_pause() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4362 v9.CheckDefAndScriptFailure(['timer_pause("x", 1)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4363 v9.CheckDefAndScriptFailure(['timer_pause(1, "a")'], ['E1013: Argument 2: type mismatch, expected bool but got string', 'E1212: Bool required for argument 2']) |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4364 enddef |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25292
diff
changeset
|
4365 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4366 def Test_timer_paused() |
23428
5807e3958e38
patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
4367 var id = timer_start(50, () => 0) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4368 timer_pause(id, true) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4369 var info = timer_info(id) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4370 info[0]['paused']->assert_equal(1) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4371 timer_stop(id) |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4372 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4373 |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
4374 def Test_timer_start() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4375 v9.CheckDefAndScriptFailure(['timer_start("a", "1")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4376 v9.CheckDefAndScriptFailure(['timer_start(1, "1", [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4377 v9.CheckDefExecAndScriptFailure(['timer_start(100, 0)'], 'E921:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4378 v9.CheckDefExecAndScriptFailure(['timer_start(100, "")'], 'E921:') |
25348
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
4379 enddef |
75031a22be39
patch 8.2.3211: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25346
diff
changeset
|
4380 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4381 def Test_timer_stop() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4382 v9.CheckDefAndScriptFailure(['timer_stop("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4383 assert_equal(0, timer_stop(100)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4384 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4385 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4386 def Test_tolower() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4387 v9.CheckDefAndScriptFailure(['tolower(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4388 tolower('')->assert_equal('') |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4389 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4390 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4391 def Test_toupper() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4392 v9.CheckDefAndScriptFailure(['toupper(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4393 toupper('')->assert_equal('') |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4394 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4395 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4396 def Test_tr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4397 v9.CheckDefAndScriptFailure(['tr(1, "a", "b")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4398 v9.CheckDefAndScriptFailure(['tr("a", 1, "b")'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4399 v9.CheckDefAndScriptFailure(['tr("a", "a", 1)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4400 tr('', '', '')->assert_equal('') |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4401 tr('ab', '', '')->assert_equal('ab') |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4402 assert_fails("tr('ab', 'ab', '')", 'E475:') |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4403 assert_fails("tr('ab', '', 'AB')", 'E475:') |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4404 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4405 |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4406 def Test_trim() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4407 v9.CheckDefAndScriptFailure(['trim(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4408 v9.CheckDefAndScriptFailure(['trim("a", ["b"])'], ['E1013: Argument 2: type mismatch, expected string but got list<string>', 'E1174: String required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4409 v9.CheckDefAndScriptFailure(['trim("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4410 trim('')->assert_equal('') |
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4411 trim('', '')->assert_equal('') |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4412 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4413 |
25196
694f114a7673
patch 8.2.3134: crash when using typename() on a function reference
Bram Moolenaar <Bram@vim.org>
parents:
25184
diff
changeset
|
4414 def Test_typename() |
694f114a7673
patch 8.2.3134: crash when using typename() on a function reference
Bram Moolenaar <Bram@vim.org>
parents:
25184
diff
changeset
|
4415 if has('float') |
694f114a7673
patch 8.2.3134: crash when using typename() on a function reference
Bram Moolenaar <Bram@vim.org>
parents:
25184
diff
changeset
|
4416 assert_equal('func([unknown], [unknown]): float', typename(function('pow'))) |
694f114a7673
patch 8.2.3134: crash when using typename() on a function reference
Bram Moolenaar <Bram@vim.org>
parents:
25184
diff
changeset
|
4417 endif |
28008
cc7d54a134e4
patch 8.2.4529: Vim9: comparing partial with function fails
Bram Moolenaar <Bram@vim.org>
parents:
27867
diff
changeset
|
4418 assert_equal('func(...): unknown', test_null_partial()->typename()) |
25692
17830c066d4b
patch 8.2.3382: crash when getting the type of a NULL partial
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
4419 assert_equal('list<unknown>', test_null_list()->typename()) |
17830c066d4b
patch 8.2.3382: crash when getting the type of a NULL partial
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
4420 assert_equal('dict<unknown>', test_null_dict()->typename()) |
17830c066d4b
patch 8.2.3382: crash when getting the type of a NULL partial
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
4421 if has('job') |
17830c066d4b
patch 8.2.3382: crash when getting the type of a NULL partial
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
4422 assert_equal('job', test_null_job()->typename()) |
17830c066d4b
patch 8.2.3382: crash when getting the type of a NULL partial
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
4423 endif |
17830c066d4b
patch 8.2.3382: crash when getting the type of a NULL partial
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
4424 if has('channel') |
17830c066d4b
patch 8.2.3382: crash when getting the type of a NULL partial
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
4425 assert_equal('channel', test_null_channel()->typename()) |
17830c066d4b
patch 8.2.3382: crash when getting the type of a NULL partial
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
4426 endif |
25196
694f114a7673
patch 8.2.3134: crash when using typename() on a function reference
Bram Moolenaar <Bram@vim.org>
parents:
25184
diff
changeset
|
4427 enddef |
694f114a7673
patch 8.2.3134: crash when using typename() on a function reference
Bram Moolenaar <Bram@vim.org>
parents:
25184
diff
changeset
|
4428 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4429 def Test_undofile() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4430 v9.CheckDefAndScriptFailure(['undofile(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4431 assert_equal('.abc.un~', fnamemodify(undofile('abc'), ':t')) |
25822
42723b535ab3
patch 8.2.3446: not enough tests for empty string arguments
Bram Moolenaar <Bram@vim.org>
parents:
25806
diff
changeset
|
4432 undofile('')->assert_equal('') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4433 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4434 |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4435 def Test_uniq() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4436 v9.CheckDefAndScriptFailure(['uniq("a")'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4437 v9.CheckDefAndScriptFailure(['uniq([1], "", [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4438 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4439 v9.CheckDefFailure(['var l: list<number> = uniq(["a", "b"])'], 'E1012: Type mismatch; expected list<number> but got list<string>') |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4440 enddef |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25326
diff
changeset
|
4441 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4442 def Test_values() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4443 v9.CheckDefAndScriptFailure(['values([])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4444 assert_equal([], {}->values()) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4445 assert_equal(['sun'], {star: 'sun'}->values()) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4446 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4447 |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4448 def Test_virtcol() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4449 v9.CheckDefAndScriptFailure(['virtcol(1.1)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1222: String or List required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4450 v9.CheckDefExecAndScriptFailure(['virtcol("")'], 'E1209: Invalid value for a line number') |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
4451 new |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
4452 setline(1, ['abcdefgh']) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
4453 cursor(1, 4) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
4454 assert_equal(4, virtcol('.')) |
25236
2c83f7b316d3
patch 8.2.3154: Vim9: some type checks for builtin functions fail
Bram Moolenaar <Bram@vim.org>
parents:
25228
diff
changeset
|
4455 assert_equal(4, virtcol([1, 4])) |
25228
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
4456 assert_equal(9, virtcol([1, '$'])) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
4457 assert_equal(0, virtcol([10, '$'])) |
a703b3f28ef4
patch 8.2.3150: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25224
diff
changeset
|
4458 bw! |
25198
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4459 enddef |
eafc0e07b188
patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25196
diff
changeset
|
4460 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4461 def Test_visualmode() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4462 v9.CheckDefAndScriptFailure(['visualmode("1")'], ['E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4463 v9.CheckDefAndScriptFailure(['visualmode(2)'], ['E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4464 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4465 |
23596
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23594
diff
changeset
|
4466 def Test_win_execute() |
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23594
diff
changeset
|
4467 assert_equal("\n" .. winnr(), win_execute(win_getid(), 'echo winnr()')) |
25224
10a5eb15a3bf
patch 8.2.3148: Vim9: function arg type check does not handle base offset
Bram Moolenaar <Bram@vim.org>
parents:
25216
diff
changeset
|
4468 assert_equal("\n" .. winnr(), 'echo winnr()'->win_execute(win_getid())) |
10a5eb15a3bf
patch 8.2.3148: Vim9: function arg type check does not handle base offset
Bram Moolenaar <Bram@vim.org>
parents:
25216
diff
changeset
|
4469 assert_equal("\n" .. winnr(), win_execute(win_getid(), 'echo winnr()', 'silent')) |
23596
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23594
diff
changeset
|
4470 assert_equal('', win_execute(342343, 'echo winnr()')) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4471 v9.CheckDefAndScriptFailure(['win_execute("a", "b", "c")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4472 v9.CheckDefAndScriptFailure(['win_execute(1, 2, "c")'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1222: String or List required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4473 v9.CheckDefAndScriptFailure(['win_execute(1, "b", 3)'], ['E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3']) |
23596
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23594
diff
changeset
|
4474 enddef |
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23594
diff
changeset
|
4475 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4476 def Test_win_findbuf() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4477 v9.CheckDefAndScriptFailure(['win_findbuf("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4478 assert_equal([], win_findbuf(1000)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4479 assert_equal([win_getid()], win_findbuf(bufnr(''))) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4480 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4481 |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4482 def Test_win_getid() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4483 v9.CheckDefAndScriptFailure(['win_getid(".")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4484 v9.CheckDefAndScriptFailure(['win_getid(1, ".")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4485 assert_equal(win_getid(), win_getid(1, 1)) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4486 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4487 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4488 def Test_win_gettype() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4489 v9.CheckDefAndScriptFailure(['win_gettype("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4490 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4491 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4492 def Test_win_gotoid() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4493 v9.CheckDefAndScriptFailure(['win_gotoid("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4494 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4495 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4496 def Test_win_id2tabwin() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4497 v9.CheckDefAndScriptFailure(['win_id2tabwin("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4498 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4499 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4500 def Test_win_id2win() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4501 v9.CheckDefAndScriptFailure(['win_id2win("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4502 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4503 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4504 def Test_win_screenpos() |
27551
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
4505 assert_equal(['x', 'x'], win_screenpos(1)->map((_, _) => 'x')) |
845e518cda11
patch 8.2.4302: Vim9: return type of getline() is too strict
Bram Moolenaar <Bram@vim.org>
parents:
27549
diff
changeset
|
4506 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4507 v9.CheckDefAndScriptFailure(['win_screenpos("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4508 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4509 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4510 def Test_win_splitmove() |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4511 split |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
4512 win_splitmove(1, 2, {vertical: true, rightbelow: true}) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4513 close |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4514 v9.CheckDefAndScriptFailure(['win_splitmove("a", 2)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4515 v9.CheckDefAndScriptFailure(['win_splitmove(1, "b")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4516 v9.CheckDefAndScriptFailure(['win_splitmove(1, 2, [])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3']) |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4517 enddef |
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4518 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4519 def Test_winbufnr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4520 v9.CheckDefAndScriptFailure(['winbufnr("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4521 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4522 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4523 def Test_winheight() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4524 v9.CheckDefAndScriptFailure(['winheight("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4525 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4526 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4527 def Test_winlayout() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4528 v9.CheckDefAndScriptFailure(['winlayout("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4529 enddef |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25250
diff
changeset
|
4530 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4531 def Test_winnr() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4532 v9.CheckDefAndScriptFailure(['winnr([])'], ['E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4533 v9.CheckDefExecAndScriptFailure(['winnr("")'], 'E15: Invalid expression') |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4534 assert_equal(1, winnr()) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4535 assert_equal(1, winnr('$')) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4536 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4537 |
23404
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
23350
diff
changeset
|
4538 def Test_winrestcmd() |
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
23350
diff
changeset
|
4539 split |
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
23350
diff
changeset
|
4540 var cmd = winrestcmd() |
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
23350
diff
changeset
|
4541 wincmd _ |
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
23350
diff
changeset
|
4542 exe cmd |
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
23350
diff
changeset
|
4543 assert_equal(cmd, winrestcmd()) |
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
23350
diff
changeset
|
4544 close |
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
23350
diff
changeset
|
4545 enddef |
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
23350
diff
changeset
|
4546 |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4547 def Test_winrestview() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4548 v9.CheckDefAndScriptFailure(['winrestview([])'], ['E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1']) |
25094
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4549 :%d _ |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4550 setline(1, 'Hello World') |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4551 winrestview({lnum: 1, col: 6}) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4552 assert_equal([1, 7], [line('.'), col('.')]) |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4553 enddef |
99494ef94fc2
patch 8.2.3084: Vim9: builtin function argument types are not checked
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
4554 |
23535
98185d3dd369
patch 8.2.2310: Vim9: winsaveview() return type is too generic
Bram Moolenaar <Bram@vim.org>
parents:
23485
diff
changeset
|
4555 def Test_winsaveview() |
98185d3dd369
patch 8.2.2310: Vim9: winsaveview() return type is too generic
Bram Moolenaar <Bram@vim.org>
parents:
23485
diff
changeset
|
4556 var view: dict<number> = winsaveview() |
98185d3dd369
patch 8.2.2310: Vim9: winsaveview() return type is too generic
Bram Moolenaar <Bram@vim.org>
parents:
23485
diff
changeset
|
4557 |
98185d3dd369
patch 8.2.2310: Vim9: winsaveview() return type is too generic
Bram Moolenaar <Bram@vim.org>
parents:
23485
diff
changeset
|
4558 var lines =<< trim END |
98185d3dd369
patch 8.2.2310: Vim9: winsaveview() return type is too generic
Bram Moolenaar <Bram@vim.org>
parents:
23485
diff
changeset
|
4559 var view: list<number> = winsaveview() |
98185d3dd369
patch 8.2.2310: Vim9: winsaveview() return type is too generic
Bram Moolenaar <Bram@vim.org>
parents:
23485
diff
changeset
|
4560 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4561 v9.CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected list<number> but got dict<number>', 1) |
23535
98185d3dd369
patch 8.2.2310: Vim9: winsaveview() return type is too generic
Bram Moolenaar <Bram@vim.org>
parents:
23485
diff
changeset
|
4562 enddef |
98185d3dd369
patch 8.2.2310: Vim9: winsaveview() return type is too generic
Bram Moolenaar <Bram@vim.org>
parents:
23485
diff
changeset
|
4563 |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4564 def Test_winwidth() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4565 v9.CheckDefAndScriptFailure(['winwidth("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4566 enddef |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4567 |
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4568 def Test_xor() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4569 v9.CheckDefAndScriptFailure(['xor("x", 0x2)'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4570 v9.CheckDefAndScriptFailure(['xor(0x1, "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2']) |
24998
3b1770226f85
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24972
diff
changeset
|
4571 enddef |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4572 |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
4573 def Test_writefile() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
4574 v9.CheckDefExecAndScriptFailure(['writefile(["a"], "")'], 'E482: Can''t create file <empty>') |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
4575 enddef |
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25731
diff
changeset
|
4576 |
22655
eabe2c1444ea
patch 8.2.1876: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4577 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |