comparison src/testdir/test_python3.vim @ 20045:04ef2ccf2519 v8.2.0578

patch 8.2.0578: heredoc for interfaces does not support "trim" Commit: https://github.com/vim/vim/commit/6c2b7b8055b96463f78abb70f58c4c6d6d4b9d55 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 14 20:15:49 2020 +0200 patch 8.2.0578: heredoc for interfaces does not support "trim" Problem: Heredoc for interfaces does not support "trim". Solution: Update the script heredoc support to be same as the :let command. (Yegappan Lakshmanan, closes #5916)
author Bram Moolenaar <Bram@vim.org>
date Tue, 14 Apr 2020 20:30:05 +0200
parents f27473034f26
children 5f9c2c7d3d73
comparison
equal deleted inserted replaced
20044:a5dca21836a2 20045:04ef2ccf2519
293 \ ['undolevels', 100, 200, -123456]] 293 \ ['undolevels', 100, 200, -123456]]
294 294
295 " Set the global and buffer-local option values and then clear the 295 " Set the global and buffer-local option values and then clear the
296 " buffer-local option value. 296 " buffer-local option value.
297 for opt in bopts 297 for opt in bopts
298 py3 pyopt = vim.bindeval("opt") 298 py3 << trim END
299 py3 vim.options[pyopt[0]] = pyopt[1] 299 pyopt = vim.bindeval("opt")
300 py3 curbuf.options[pyopt[0]] = pyopt[2] 300 vim.options[pyopt[0]] = pyopt[1]
301 curbuf.options[pyopt[0]] = pyopt[2]
302 END
301 exe "call assert_equal(opt[2], &" .. opt[0] .. ")" 303 exe "call assert_equal(opt[2], &" .. opt[0] .. ")"
302 exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")" 304 exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")"
303 exe "call assert_equal(opt[2], &l:" .. opt[0] .. ")" 305 exe "call assert_equal(opt[2], &l:" .. opt[0] .. ")"
304 py3 del curbuf.options[pyopt[0]] 306 py3 del curbuf.options[pyopt[0]]
305 exe "call assert_equal(opt[1], &" .. opt[0] .. ")" 307 exe "call assert_equal(opt[1], &" .. opt[0] .. ")"
313 let wopts = [ 315 let wopts = [
314 \ ['scrolloff', 5, 10, -1], 316 \ ['scrolloff', 5, 10, -1],
315 \ ['sidescrolloff', 6, 12, -1], 317 \ ['sidescrolloff', 6, 12, -1],
316 \ ['statusline', '%<%f', '%<%F', '']] 318 \ ['statusline', '%<%f', '%<%F', '']]
317 for opt in wopts 319 for opt in wopts
318 py3 pyopt = vim.bindeval("opt") 320 py3 << trim
319 py3 vim.options[pyopt[0]] = pyopt[1] 321 pyopt = vim.bindeval("opt")
320 py3 curwin.options[pyopt[0]] = pyopt[2] 322 vim.options[pyopt[0]] = pyopt[1]
323 curwin.options[pyopt[0]] = pyopt[2]
324 .
321 exe "call assert_equal(opt[2], &" .. opt[0] .. ")" 325 exe "call assert_equal(opt[2], &" .. opt[0] .. ")"
322 exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")" 326 exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")"
323 exe "call assert_equal(opt[2], &l:" .. opt[0] .. ")" 327 exe "call assert_equal(opt[2], &l:" .. opt[0] .. ")"
324 py3 del curwin.options[pyopt[0]] 328 py3 del curwin.options[pyopt[0]]
325 exe "call assert_equal(opt[1], &" .. opt[0] .. ")" 329 exe "call assert_equal(opt[1], &" .. opt[0] .. ")"
329 endfor 333 endfor
330 334
331 close! 335 close!
332 endfunc 336 endfunc
333 337
338 " Test for various heredoc syntax
339 func Test_python3_heredoc()
340 python3 << END
341 s='A'
342 END
343 python3 <<
344 s+='B'
345 .
346 python3 << trim END
347 s+='C'
348 END
349 python3 << trim
350 s+='D'
351 .
352 call assert_equal('ABCD', pyxeval('s'))
353 endfunc
354
334 " vim: shiftwidth=2 sts=2 expandtab 355 " vim: shiftwidth=2 sts=2 expandtab