Mercurial > vim
comparison src/testdir/test_search.vim @ 12732:75abce3e933d v8.0.1244
patch 8.0.1244: search test does not work correctly on MS-Windows
commit https://github.com/vim/vim/commit/b94340c04f524482b408543daa1142f883831cab
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 2 16:16:31 2017 +0100
patch 8.0.1244: search test does not work correctly on MS-Windows
Problem: Search test does not work correctly on MS-Windows.
Solution: Put text in a file instead of sending it to the terminal.
(Christian Brabandt)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 02 Nov 2017 16:30:07 +0100 |
parents | 6fa9f6b4d159 |
children | 0c704288ced4 |
comparison
equal
deleted
inserted
replaced
12731:ea9796ba34d1 | 12732:75abce3e933d |
---|---|
492 endif | 492 endif |
493 let h = winheight(0) | 493 let h = winheight(0) |
494 if h < 3 | 494 if h < 3 |
495 return | 495 return |
496 endif | 496 endif |
497 let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) | |
498 | 497 |
499 " Prepare buffer text | 498 " Prepare buffer text |
500 let lines = ['abb vim vim vi', 'vimvivim'] | 499 let g:lines = ['abb vim vim vi', 'vimvivim'] |
501 call term_sendkeys(g:buf, 'i' . join(lines, "\n") . "\<esc>gg0") | 500 call writefile(g:lines, 'Xsearch.txt') |
502 call term_wait(g:buf, 200) | 501 let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) |
503 call assert_equal(lines[0], term_getline(g:buf, 1)) | 502 call WaitFor('g:lines[0] == term_getline(g:buf, 1)') |
503 call assert_equal(g:lines[0], term_getline(g:buf, 1)) | |
504 call assert_equal(g:lines[1], term_getline(g:buf, 2)) | |
505 unlet g:lines | |
504 | 506 |
505 " Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight | 507 " Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight |
506 call term_sendkeys(g:buf, ":set incsearch hlsearch\<cr>") | 508 call term_sendkeys(g:buf, ":set incsearch hlsearch\<cr>") |
507 call term_sendkeys(g:buf, '/b') | 509 call term_sendkeys(g:buf, '/b') |
508 call term_wait(g:buf, 200) | 510 call term_wait(g:buf, 200) |
563 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a0,a0,a0,a0,a0,a0] | 565 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a0,a0,a0,a0,a0,a0] |
564 let attr_line2 = [a0,a0,a0,a0,a0,a0,a0,a0] | 566 let attr_line2 = [a0,a0,a0,a0,a0,a0,a0,a0] |
565 call assert_equal(attr_line1, map(term_scrape(g:buf, 1)[:len(attr_line1)-1], 'v:val.attr')) | 567 call assert_equal(attr_line1, map(term_scrape(g:buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
566 call assert_equal(attr_line2, map(term_scrape(g:buf, 2)[:len(attr_line2)-1], 'v:val.attr')) | 568 call assert_equal(attr_line2, map(term_scrape(g:buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
567 | 569 |
570 call delete('Xsearch.txt') | |
568 bwipe! | 571 bwipe! |
569 endfunc | 572 endfunc |
570 | 573 |
571 func Test_search_undefined_behaviour() | 574 func Test_search_undefined_behaviour() |
572 if !has("terminal") | 575 if !has("terminal") |