comparison src/testdir/test_functions.vim @ 19795:1c7f92a1100e v8.2.0454

patch 8.2.0454: some tests fail when the system is slow Commit: https://github.com/vim/vim/commit/3ed9efc2b15b624268bcce4e4d312fb35840a12b Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 26 16:50:57 2020 +0100 patch 8.2.0454: some tests fail when the system is slow Problem: Some tests fail when the system is slow. Solution: Make the run number global, use in the test to increase the waiting time. (closes #5841)
author Bram Moolenaar <Bram@vim.org>
date Thu, 26 Mar 2020 17:00:04 +0100
parents 546bdeef35f1
children 481e8fa158b4
comparison
equal deleted inserted replaced
19794:37fc7cc2d83b 19795:1c7f92a1100e
1830 endfunc 1830 endfunc
1831 1831
1832 func Test_state() 1832 func Test_state()
1833 CheckRunVimInTerminal 1833 CheckRunVimInTerminal
1834 1834
1835 " In the first run try a short wait time. If the test fails retry with a
1836 " longer wait time.
1837 if g:run_nr == 1
1838 let wait_time = 50
1839 elseif g:run_nr == 2
1840 let wait_time = 200
1841 else
1842 let wait_time = 500
1843 endif
1844 let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\<CR>"
1845
1835 let lines =<< trim END 1846 let lines =<< trim END
1836 call setline(1, ['one', 'two', 'three']) 1847 call setline(1, ['one', 'two', 'three'])
1837 map ;; gg 1848 map ;; gg
1838 set complete=. 1849 set complete=.
1839 func RunTimer() 1850 func RunTimer()
1849 call WaitForAssert({-> assert_match('state: S; mode: n', term_getline(buf, 6))}, 1000) 1860 call WaitForAssert({-> assert_match('state: S; mode: n', term_getline(buf, 6))}, 1000)
1850 call term_sendkeys(buf, ":\<CR>") 1861 call term_sendkeys(buf, ":\<CR>")
1851 1862
1852 " Using a timer callback 1863 " Using a timer callback
1853 call term_sendkeys(buf, ":call RunTimer()\<CR>") 1864 call term_sendkeys(buf, ":call RunTimer()\<CR>")
1854 call term_wait(buf, 50) 1865 call term_wait(buf, wait_time)
1855 let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\<CR>"
1856 call term_sendkeys(buf, getstate) 1866 call term_sendkeys(buf, getstate)
1857 call WaitForAssert({-> assert_match('state: c; mode: n', term_getline(buf, 6))}, 1000) 1867 call WaitForAssert({-> assert_match('state: c; mode: n', term_getline(buf, 6))}, 1000)
1858 1868
1859 " Halfway a mapping 1869 " Halfway a mapping
1860 call term_sendkeys(buf, ":call RunTimer()\<CR>;") 1870 call term_sendkeys(buf, ":call RunTimer()\<CR>;")
1861 call term_wait(buf, 50) 1871 call term_wait(buf, wait_time)
1862 call term_sendkeys(buf, ";") 1872 call term_sendkeys(buf, ";")
1863 call term_sendkeys(buf, getstate) 1873 call term_sendkeys(buf, getstate)
1864 call WaitForAssert({-> assert_match('state: mSc; mode: n', term_getline(buf, 6))}, 1000) 1874 call WaitForAssert({-> assert_match('state: mSc; mode: n', term_getline(buf, 6))}, 1000)
1865 1875
1866 " Insert mode completion (bit slower on Mac) 1876 " Insert mode completion (bit slower on Mac)
1867 call term_sendkeys(buf, ":call RunTimer()\<CR>Got\<C-N>") 1877 call term_sendkeys(buf, ":call RunTimer()\<CR>Got\<C-N>")
1868 call term_wait(buf, 200) 1878 call term_wait(buf, wait_time)
1869 call term_sendkeys(buf, "\<Esc>") 1879 call term_sendkeys(buf, "\<Esc>")
1870 call term_sendkeys(buf, getstate) 1880 call term_sendkeys(buf, getstate)
1871 call WaitForAssert({-> assert_match('state: aSc; mode: i', term_getline(buf, 6))}, 1000) 1881 call WaitForAssert({-> assert_match('state: aSc; mode: i', term_getline(buf, 6))}, 1000)
1872 1882
1873 " Autocommand executing 1883 " Autocommand executing
1874 call term_sendkeys(buf, ":set filetype=foobar\<CR>") 1884 call term_sendkeys(buf, ":set filetype=foobar\<CR>")
1875 call term_wait(buf, 50) 1885 call term_wait(buf, wait_time)
1876 call term_sendkeys(buf, getstate) 1886 call term_sendkeys(buf, getstate)
1877 call WaitForAssert({-> assert_match('state: xS; mode: n', term_getline(buf, 6))}, 1000) 1887 call WaitForAssert({-> assert_match('state: xS; mode: n', term_getline(buf, 6))}, 1000)
1878 1888
1879 " Todo: "w" - waiting for ch_evalexpr() 1889 " Todo: "w" - waiting for ch_evalexpr()
1880 1890
1881 " messages scrolled 1891 " messages scrolled
1882 call term_sendkeys(buf, ":call RunTimer()\<CR>:echo \"one\\ntwo\\nthree\"\<CR>") 1892 call term_sendkeys(buf, ":call RunTimer()\<CR>:echo \"one\\ntwo\\nthree\"\<CR>")
1883 call term_wait(buf, 50) 1893 call term_wait(buf, wait_time)
1884 call term_sendkeys(buf, "\<CR>") 1894 call term_sendkeys(buf, "\<CR>")
1885 call term_sendkeys(buf, getstate) 1895 call term_sendkeys(buf, getstate)
1886 call WaitForAssert({-> assert_match('state: Scs; mode: r', term_getline(buf, 6))}, 1000) 1896 call WaitForAssert({-> assert_match('state: Scs; mode: r', term_getline(buf, 6))}, 1000)
1887 1897
1888 call StopVimInTerminal(buf) 1898 call StopVimInTerminal(buf)