comparison src/testdir/test_search.vim @ 19954:c087099e9163 v8.2.0533

patch 8.2.0533: tests using term_wait() can still be flaky Commit: https://github.com/vim/vim/commit/6a2c5a7dd5c9215cc030d5ea6e4616d782c091dd Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 8 21:50:25 2020 +0200 patch 8.2.0533: tests using term_wait() can still be flaky Problem: Tests using term_wait() can still be flaky. Solution: Increase the wait time when rerunning a test. (James McCoy, closes #5899) Halve the initial times to make tests run faster when there is no rerun.
author Bram Moolenaar <Bram@vim.org>
date Wed, 08 Apr 2020 22:00:05 +0200
parents 9cbe3a4f1492
children 0b42b5e50344
comparison
equal deleted inserted replaced
19953:313ad6f6fdb5 19954:c087099e9163
670 call term_sendkeys(buf, ":set incsearch hlsearch\<cr>") 670 call term_sendkeys(buf, ":set incsearch hlsearch\<cr>")
671 call term_sendkeys(buf, ":14vsp\<cr>") 671 call term_sendkeys(buf, ":14vsp\<cr>")
672 call term_sendkeys(buf, "/vim\<cr>") 672 call term_sendkeys(buf, "/vim\<cr>")
673 call term_sendkeys(buf, "/b\<esc>") 673 call term_sendkeys(buf, "/b\<esc>")
674 call term_sendkeys(buf, "gg0") 674 call term_sendkeys(buf, "gg0")
675 call term_wait(buf, 500) 675 call TermWait(buf, 250)
676 let screen_line = term_scrape(buf, 1) 676 let screen_line = term_scrape(buf, 1)
677 let [a0,a1,a2,a3] = [screen_line[3].attr, screen_line[4].attr, 677 let [a0,a1,a2,a3] = [screen_line[3].attr, screen_line[4].attr,
678 \ screen_line[18].attr, screen_line[19].attr] 678 \ screen_line[18].attr, screen_line[19].attr]
679 call assert_notequal(a0, a1) 679 call assert_notequal(a0, a1)
680 call assert_notequal(a0, a3) 680 call assert_notequal(a0, a3)
790 call writefile(lines, 'Xsearch.txt') 790 call writefile(lines, 'Xsearch.txt')
791 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) 791 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3})
792 792
793 call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])}) 793 call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])})
794 " wait for vim to complete initialization 794 " wait for vim to complete initialization
795 call term_wait(buf) 795 call TermWait(buf)
796 796
797 " Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight 797 " Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight
798 call term_sendkeys(buf, ":set incsearch hlsearch\<cr>") 798 call term_sendkeys(buf, ":set incsearch hlsearch\<cr>")
799 call term_sendkeys(buf, '/b') 799 call term_sendkeys(buf, '/b')
800 call term_wait(buf, 200) 800 call TermWait(buf, 100)
801 let screen_line1 = term_scrape(buf, 1) 801 let screen_line1 = term_scrape(buf, 1)
802 call assert_true(len(screen_line1) > 2) 802 call assert_true(len(screen_line1) > 2)
803 " a0: attr_normal 803 " a0: attr_normal
804 let a0 = screen_line1[0].attr 804 let a0 = screen_line1[0].attr
805 " a1: attr_incsearch 805 " a1: attr_incsearch
811 call assert_notequal(a1, a2) 811 call assert_notequal(a1, a2)
812 call term_sendkeys(buf, "\<cr>gg0") 812 call term_sendkeys(buf, "\<cr>gg0")
813 813
814 " Test incremental highlight search 814 " Test incremental highlight search
815 call term_sendkeys(buf, "/vim") 815 call term_sendkeys(buf, "/vim")
816 call term_wait(buf, 200) 816 call TermWait(buf, 100)
817 " Buffer: 817 " Buffer:
818 " abb vim vim vi 818 " abb vim vim vi
819 " vimvivim 819 " vimvivim
820 " Search: /vim 820 " Search: /vim
821 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a2,a2,a2,a0,a0,a0] 821 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a2,a2,a2,a0,a0,a0]
823 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) 823 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
824 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) 824 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
825 825
826 " Test <C-g> 826 " Test <C-g>
827 call term_sendkeys(buf, "\<C-g>\<C-g>") 827 call term_sendkeys(buf, "\<C-g>\<C-g>")
828 call term_wait(buf, 200) 828 call TermWait(buf, 100)
829 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0] 829 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0]
830 let attr_line2 = [a1,a1,a1,a0,a0,a2,a2,a2] 830 let attr_line2 = [a1,a1,a1,a0,a0,a2,a2,a2]
831 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) 831 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
832 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) 832 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
833 833
834 " Test <C-t> 834 " Test <C-t>
835 call term_sendkeys(buf, "\<C-t>") 835 call term_sendkeys(buf, "\<C-t>")
836 call term_wait(buf, 200) 836 call TermWait(buf, 100)
837 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a1,a1,a1,a0,a0,a0] 837 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a1,a1,a1,a0,a0,a0]
838 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] 838 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2]
839 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) 839 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
840 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) 840 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
841 841
842 " Type Enter and a1(incsearch highlight) should become a2(hlsearch highlight) 842 " Type Enter and a1(incsearch highlight) should become a2(hlsearch highlight)
843 call term_sendkeys(buf, "\<cr>") 843 call term_sendkeys(buf, "\<cr>")
844 call term_wait(buf, 200) 844 call TermWait(buf, 100)
845 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0] 845 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0]
846 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] 846 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2]
847 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) 847 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
848 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) 848 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
849 849
850 " Test nohlsearch. a2(hlsearch highlight) should become a0(normal highlight) 850 " Test nohlsearch. a2(hlsearch highlight) should become a0(normal highlight)
851 call term_sendkeys(buf, ":1\<cr>") 851 call term_sendkeys(buf, ":1\<cr>")
852 call term_sendkeys(buf, ":set nohlsearch\<cr>") 852 call term_sendkeys(buf, ":set nohlsearch\<cr>")
853 call term_sendkeys(buf, "/vim") 853 call term_sendkeys(buf, "/vim")
854 call term_wait(buf, 200) 854 call TermWait(buf, 100)
855 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a0,a0,a0,a0,a0,a0] 855 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a0,a0,a0,a0,a0,a0]
856 let attr_line2 = [a0,a0,a0,a0,a0,a0,a0,a0] 856 let attr_line2 = [a0,a0,a0,a0,a0,a0,a0,a0]
857 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) 857 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
858 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) 858 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
859 call delete('Xsearch.txt') 859 call delete('Xsearch.txt')