comparison src/testdir/test_substitute.vim @ 18483:54e5fa1f9cfc v8.1.2236

patch 8.1.2236: ml_get error if pattern matches beyond last line Commit: https://github.com/vim/vim/commit/bb26596242fa7db477e2cd706dd99f9a426b5f71 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 31 04:38:36 2019 +0100 patch 8.1.2236: ml_get error if pattern matches beyond last line Problem: Ml_get error if pattern matches beyond last line. Solution: Adjust position if needed. (Christian Brabandt, closes https://github.com/vim/vim/issues/5139)
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Oct 2019 04:45:03 +0100
parents 988e5a868b60
children 23fef64352a1
comparison
equal deleted inserted replaced
18482:f8975b6004e6 18483:54e5fa1f9cfc
411 func Run_SubCmd_Tests(tests) 411 func Run_SubCmd_Tests(tests)
412 enew! 412 enew!
413 for t in a:tests 413 for t in a:tests
414 let start = line('.') + 1 414 let start = line('.') + 1
415 let end = start + len(t[2]) - 1 415 let end = start + len(t[2]) - 1
416 " TODO: why is there a one second delay the first time we get here?
416 exe "normal o" . t[0] 417 exe "normal o" . t[0]
417 call cursor(start, 1) 418 call cursor(start, 1)
418 exe t[1] 419 exe t[1]
419 call assert_equal(t[2], getline(start, end), t[1]) 420 call assert_equal(t[2], getline(start, end), t[1])
420 endfor 421 endfor
714 exe "normal 0dn" 715 exe "normal 0dn"
715 call assert_equal('xyz', getline('.')) 716 call assert_equal('xyz', getline('.'))
716 717
717 close! 718 close!
718 endfunc 719 endfunc
720
721 func Test_sub_beyond_end()
722 new
723 call setline(1, '#')
724 let @/ = '^#\n\zs'
725 s///e
726 call assert_equal('#', getline(1))
727 bwipe!
728 endfunc