comparison src/testdir/test_vim9_expr.vim @ 21642:5ae89c8633ae v8.2.1371

patch 8.2.1371: Vim9: no error for missing white space around operator Commit: https://github.com/vim/vim/commit/3c1c9fd94bc80871119a8519f3b881595082a6c0 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 5 12:32:38 2020 +0200 patch 8.2.1371: Vim9: no error for missing white space around operator Problem: Vim9: no error for missing white space around operator. Solution: Check for white space around && and ||.
author Bram Moolenaar <Bram@vim.org>
date Wed, 05 Aug 2020 12:45:03 +0200
parents dcfcb6163f3d
children 7d3ba70a03f1
comparison
equal deleted inserted replaced
21641:20b0520f1174 21642:5ae89c8633ae
173 v:false 173 v:false
174 assert_equal(v:true, var) 174 assert_equal(v:true, var)
175 END 175 END
176 CheckScriptSuccess(lines) 176 CheckScriptSuccess(lines)
177 177
178 # check white space
179 lines =<< trim END
180 vim9script
181 let var = v:true||v:true
182 END
183 CheckScriptFailure(lines, 'E1004:')
184 lines =<< trim END
185 vim9script
186 let var = v:true ||v:true
187 END
188 CheckScriptFailure(lines, 'E1004:')
189 lines =<< trim END
190 vim9script
191 let var = v:true|| v:true
192 END
193 CheckScriptFailure(lines, 'E1004:')
194
178 # check keeping the value 195 # check keeping the value
179 lines =<< trim END 196 lines =<< trim END
180 vim9script 197 vim9script
181 assert_equal(2, 2 || 0) 198 assert_equal(2, 2 || 0)
182 assert_equal(7, 0 || 199 assert_equal(7, 0 ||
276 v:true && 293 v:true &&
277 v:true 294 v:true
278 assert_equal(v:true, var) 295 assert_equal(v:true, var)
279 END 296 END
280 CheckScriptSuccess(lines) 297 CheckScriptSuccess(lines)
298
299 # check white space
300 lines =<< trim END
301 vim9script
302 let var = v:true&&v:true
303 END
304 CheckScriptFailure(lines, 'E1004:')
305 lines =<< trim END
306 vim9script
307 let var = v:true &&v:true
308 END
309 CheckScriptFailure(lines, 'E1004:')
310 lines =<< trim END
311 vim9script
312 let var = v:true&& v:true
313 END
314 CheckScriptFailure(lines, 'E1004:')
281 315
282 # check keeping the value 316 # check keeping the value
283 lines =<< trim END 317 lines =<< trim END
284 vim9script 318 vim9script
285 assert_equal(0, 2 && 0) 319 assert_equal(0, 2 && 0)