Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 22296:006b8ab9d554 v8.2.1697
patch 8.2.1697: inconsistent capitalization of error messages
Commit: https://github.com/vim/vim/commit/7707228aace9aff16434edf5377a354c6ad07316
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 16 17:55:40 2020 +0200
patch 8.2.1697: inconsistent capitalization of error messages
Problem: Inconsistent capitalization of error messages.
Solution: Always start with a capital.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Sep 2020 18:00:04 +0200 |
parents | 6b385c2b9ff5 |
children | a5b16c9eee9d |
comparison
equal
deleted
inserted
replaced
22295:dbcb2b62f53a | 22296:006b8ab9d554 |
---|---|
141 enddef | 141 enddef |
142 | 142 |
143 func Test_expr1_fails() | 143 func Test_expr1_fails() |
144 call CheckDefFailure(["let x = 1 ? 'one'"], "Missing ':' after '?'", 1) | 144 call CheckDefFailure(["let x = 1 ? 'one'"], "Missing ':' after '?'", 1) |
145 | 145 |
146 let msg = "white space required before and after '?'" | 146 let msg = "White space required before and after '?'" |
147 call CheckDefFailure(["let x = 1? 'one' : 'two'"], msg, 1) | 147 call CheckDefFailure(["let x = 1? 'one' : 'two'"], msg, 1) |
148 call CheckDefFailure(["let x = 1 ?'one' : 'two'"], msg, 1) | 148 call CheckDefFailure(["let x = 1 ?'one' : 'two'"], msg, 1) |
149 call CheckDefFailure(["let x = 1?'one' : 'two'"], msg, 1) | 149 call CheckDefFailure(["let x = 1?'one' : 'two'"], msg, 1) |
150 | 150 |
151 let msg = "white space required before and after ':'" | 151 let msg = "White space required before and after ':'" |
152 call CheckDefFailure(["let x = 1 ? 'one': 'two'"], msg, 1) | 152 call CheckDefFailure(["let x = 1 ? 'one': 'two'"], msg, 1) |
153 call CheckDefFailure(["let x = 1 ? 'one' :'two'"], msg, 1) | 153 call CheckDefFailure(["let x = 1 ? 'one' :'two'"], msg, 1) |
154 call CheckDefFailure(["let x = 1 ? 'one':'two'"], msg, 1) | 154 call CheckDefFailure(["let x = 1 ? 'one':'two'"], msg, 1) |
155 | 155 |
156 " missing argument detected even when common type is used | 156 " missing argument detected even when common type is used |
274 END | 274 END |
275 CheckScriptSuccess(lines) | 275 CheckScriptSuccess(lines) |
276 enddef | 276 enddef |
277 | 277 |
278 func Test_expr2_fails() | 278 func Test_expr2_fails() |
279 let msg = "white space required before and after '||'" | 279 let msg = "White space required before and after '||'" |
280 call CheckDefFailure(["let x = 1||2"], msg, 1) | 280 call CheckDefFailure(["let x = 1||2"], msg, 1) |
281 call CheckDefFailure(["let x = 1 ||2"], msg, 1) | 281 call CheckDefFailure(["let x = 1 ||2"], msg, 1) |
282 call CheckDefFailure(["let x = 1|| 2"], msg, 1) | 282 call CheckDefFailure(["let x = 1|| 2"], msg, 1) |
283 | 283 |
284 call CheckDefFailure(["let x = 1 || xxx"], 'E1001:', 1) | 284 call CheckDefFailure(["let x = 1 || xxx"], 'E1001:', 1) |
399 END | 399 END |
400 CheckScriptSuccess(lines) | 400 CheckScriptSuccess(lines) |
401 enddef | 401 enddef |
402 | 402 |
403 func Test_expr3_fails() | 403 func Test_expr3_fails() |
404 let msg = "white space required before and after '&&'" | 404 let msg = "White space required before and after '&&'" |
405 call CheckDefFailure(["let x = 1&&2"], msg, 1) | 405 call CheckDefFailure(["let x = 1&&2"], msg, 1) |
406 call CheckDefFailure(["let x = 1 &&2"], msg, 1) | 406 call CheckDefFailure(["let x = 1 &&2"], msg, 1) |
407 call CheckDefFailure(["let x = 1&& 2"], msg, 1) | 407 call CheckDefFailure(["let x = 1&& 2"], msg, 1) |
408 endfunc | 408 endfunc |
409 | 409 |
859 END | 859 END |
860 CheckScriptSuccess(lines) | 860 CheckScriptSuccess(lines) |
861 enddef | 861 enddef |
862 | 862 |
863 func Test_expr4_fails() | 863 func Test_expr4_fails() |
864 let msg = "white space required before and after '>'" | 864 let msg = "White space required before and after '>'" |
865 call CheckDefFailure(["let x = 1>2"], msg, 1) | 865 call CheckDefFailure(["let x = 1>2"], msg, 1) |
866 call CheckDefFailure(["let x = 1 >2"], msg, 1) | 866 call CheckDefFailure(["let x = 1 >2"], msg, 1) |
867 call CheckDefFailure(["let x = 1> 2"], msg, 1) | 867 call CheckDefFailure(["let x = 1> 2"], msg, 1) |
868 | 868 |
869 let msg = "white space required before and after '=='" | 869 let msg = "White space required before and after '=='" |
870 call CheckDefFailure(["let x = 1==2"], msg, 1) | 870 call CheckDefFailure(["let x = 1==2"], msg, 1) |
871 call CheckDefFailure(["let x = 1 ==2"], msg, 1) | 871 call CheckDefFailure(["let x = 1 ==2"], msg, 1) |
872 call CheckDefFailure(["let x = 1== 2"], msg, 1) | 872 call CheckDefFailure(["let x = 1== 2"], msg, 1) |
873 | 873 |
874 let msg = "white space required before and after 'is'" | 874 let msg = "White space required before and after 'is'" |
875 call CheckDefFailure(["let x = '1'is'2'"], msg, 1) | 875 call CheckDefFailure(["let x = '1'is'2'"], msg, 1) |
876 call CheckDefFailure(["let x = '1' is'2'"], msg, 1) | 876 call CheckDefFailure(["let x = '1' is'2'"], msg, 1) |
877 call CheckDefFailure(["let x = '1'is '2'"], msg, 1) | 877 call CheckDefFailure(["let x = '1'is '2'"], msg, 1) |
878 | 878 |
879 let msg = "white space required before and after 'isnot'" | 879 let msg = "White space required before and after 'isnot'" |
880 call CheckDefFailure(["let x = '1'isnot'2'"], msg, 1) | 880 call CheckDefFailure(["let x = '1'isnot'2'"], msg, 1) |
881 call CheckDefFailure(["let x = '1' isnot'2'"], msg, 1) | 881 call CheckDefFailure(["let x = '1' isnot'2'"], msg, 1) |
882 call CheckDefFailure(["let x = '1'isnot '2'"], msg, 1) | 882 call CheckDefFailure(["let x = '1'isnot '2'"], msg, 1) |
883 | 883 |
884 call CheckDefFailure(["let x = 1 is# 2"], 'E15:', 1) | 884 call CheckDefFailure(["let x = 1 is# 2"], 'E15:', 1) |
1149 assert_equal(-9.9, g:afloat - g:anint) | 1149 assert_equal(-9.9, g:afloat - g:anint) |
1150 endif | 1150 endif |
1151 enddef | 1151 enddef |
1152 | 1152 |
1153 func Test_expr5_fails() | 1153 func Test_expr5_fails() |
1154 let msg = "white space required before and after '+'" | 1154 let msg = "White space required before and after '+'" |
1155 call CheckDefFailure(["let x = 1+2"], msg, 1) | 1155 call CheckDefFailure(["let x = 1+2"], msg, 1) |
1156 call CheckDefFailure(["let x = 1 +2"], msg, 1) | 1156 call CheckDefFailure(["let x = 1 +2"], msg, 1) |
1157 call CheckDefFailure(["let x = 1+ 2"], msg, 1) | 1157 call CheckDefFailure(["let x = 1+ 2"], msg, 1) |
1158 | 1158 |
1159 let msg = "white space required before and after '-'" | 1159 let msg = "White space required before and after '-'" |
1160 call CheckDefFailure(["let x = 1-2"], msg, 1) | 1160 call CheckDefFailure(["let x = 1-2"], msg, 1) |
1161 call CheckDefFailure(["let x = 1 -2"], msg, 1) | 1161 call CheckDefFailure(["let x = 1 -2"], msg, 1) |
1162 call CheckDefFailure(["let x = 1- 2"], msg, 1) | 1162 call CheckDefFailure(["let x = 1- 2"], msg, 1) |
1163 | 1163 |
1164 let msg = "white space required before and after '..'" | 1164 let msg = "White space required before and after '..'" |
1165 call CheckDefFailure(["let x = '1'..'2'"], msg, 1) | 1165 call CheckDefFailure(["let x = '1'..'2'"], msg, 1) |
1166 call CheckDefFailure(["let x = '1' ..'2'"], msg, 1) | 1166 call CheckDefFailure(["let x = '1' ..'2'"], msg, 1) |
1167 call CheckDefFailure(["let x = '1'.. '2'"], msg, 1) | 1167 call CheckDefFailure(["let x = '1'.. '2'"], msg, 1) |
1168 | 1168 |
1169 call CheckDefFailure(["let x = 0z1122 + 33"], 'E1051', 1) | 1169 call CheckDefFailure(["let x = 0z1122 + 33"], 'E1051', 1) |
1304 assert_equal(4.0, 6.0 * 4.0 / 6.0) | 1304 assert_equal(4.0, 6.0 * 4.0 / 6.0) |
1305 endif | 1305 endif |
1306 enddef | 1306 enddef |
1307 | 1307 |
1308 func Test_expr6_fails() | 1308 func Test_expr6_fails() |
1309 let msg = "white space required before and after '*'" | 1309 let msg = "White space required before and after '*'" |
1310 call CheckDefFailure(["let x = 1*2"], msg, 1) | 1310 call CheckDefFailure(["let x = 1*2"], msg, 1) |
1311 call CheckDefFailure(["let x = 1 *2"], msg, 1) | 1311 call CheckDefFailure(["let x = 1 *2"], msg, 1) |
1312 call CheckDefFailure(["let x = 1* 2"], msg, 1) | 1312 call CheckDefFailure(["let x = 1* 2"], msg, 1) |
1313 | 1313 |
1314 let msg = "white space required before and after '/'" | 1314 let msg = "White space required before and after '/'" |
1315 call CheckDefFailure(["let x = 1/2"], msg, 1) | 1315 call CheckDefFailure(["let x = 1/2"], msg, 1) |
1316 call CheckDefFailure(["let x = 1 /2"], msg, 1) | 1316 call CheckDefFailure(["let x = 1 /2"], msg, 1) |
1317 call CheckDefFailure(["let x = 1/ 2"], msg, 1) | 1317 call CheckDefFailure(["let x = 1/ 2"], msg, 1) |
1318 | 1318 |
1319 let msg = "white space required before and after '%'" | 1319 let msg = "White space required before and after '%'" |
1320 call CheckDefFailure(["let x = 1%2"], msg, 1) | 1320 call CheckDefFailure(["let x = 1%2"], msg, 1) |
1321 call CheckDefFailure(["let x = 1 %2"], msg, 1) | 1321 call CheckDefFailure(["let x = 1 %2"], msg, 1) |
1322 call CheckDefFailure(["let x = 1% 2"], msg, 1) | 1322 call CheckDefFailure(["let x = 1% 2"], msg, 1) |
1323 | 1323 |
1324 call CheckDefFailure(["let x = '1' * '2'"], 'E1036:', 1) | 1324 call CheckDefFailure(["let x = '1' * '2'"], 'E1036:', 1) |
1656 CheckDefFailure(["let L = {a -> a + b}"], 'E1001:', 0) | 1656 CheckDefFailure(["let L = {a -> a + b}"], 'E1001:', 0) |
1657 | 1657 |
1658 assert_equal('xxxyyy', 'xxx'->{a, b -> a .. b}('yyy')) | 1658 assert_equal('xxxyyy', 'xxx'->{a, b -> a .. b}('yyy')) |
1659 | 1659 |
1660 CheckDefExecFailure(["let s = 'asdf'->{a -> a}('x')"], | 1660 CheckDefExecFailure(["let s = 'asdf'->{a -> a}('x')"], |
1661 'E1106: one argument too many') | 1661 'E1106: One argument too many') |
1662 CheckDefExecFailure(["let s = 'asdf'->{a -> a}('x', 'y')"], | 1662 CheckDefExecFailure(["let s = 'asdf'->{a -> a}('x', 'y')"], |
1663 'E1106: 2 arguments too many') | 1663 'E1106: 2 arguments too many') |
1664 CheckDefFailure(["echo 'asdf'->{a -> a}(x)"], 'E1001:', 1) | 1664 CheckDefFailure(["echo 'asdf'->{a -> a}(x)"], 'E1001:', 1) |
1665 enddef | 1665 enddef |
1666 | 1666 |