Mercurial > vim
comparison src/testdir/test_terminal.vim @ 18041:060e1b1220c6 v8.1.2016
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Commit: https://github.com/vim/vim/commit/adbde3fbedd4a5379ddf0cfc9a6854b52955fd4a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 8 22:57:14 2019 +0200
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Problem: Terminal altscreen test now fails on MS-Windows.
Solution: Skip the test on MS-Windows
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 08 Sep 2019 23:00:04 +0200 |
parents | ef5720fb6f41 |
children | 873068e19e1f |
comparison
equal
deleted
inserted
replaced
18040:14ba3b14b332 | 18041:060e1b1220c6 |
---|---|
319 set termwinscroll& | 319 set termwinscroll& |
320 call delete('Xtext') | 320 call delete('Xtext') |
321 endfunc | 321 endfunc |
322 | 322 |
323 func Test_terminal_postponed_scrollback() | 323 func Test_terminal_postponed_scrollback() |
324 if !has('unix') | 324 " tail -f only works on Unix |
325 " tail -f only works on Unix | 325 CheckUnix |
326 return | |
327 endif | |
328 | 326 |
329 call writefile(range(50), 'Xtext') | 327 call writefile(range(50), 'Xtext') |
330 call writefile([ | 328 call writefile([ |
331 \ 'set shell=/bin/sh noruler', | 329 \ 'set shell=/bin/sh noruler', |
332 \ 'terminal', | 330 \ 'terminal', |
738 bwipe! | 736 bwipe! |
739 endfunc | 737 endfunc |
740 | 738 |
741 func Test_terminal_special_chars() | 739 func Test_terminal_special_chars() |
742 " this file name only works on Unix | 740 " this file name only works on Unix |
743 if !has('unix') | 741 CheckUnix |
744 return | 742 |
745 endif | |
746 call mkdir('Xdir with spaces') | 743 call mkdir('Xdir with spaces') |
747 call writefile(['x'], 'Xdir with spaces/quoted"file') | 744 call writefile(['x'], 'Xdir with spaces/quoted"file') |
748 term ls Xdir\ with\ spaces/quoted\"file | 745 term ls Xdir\ with\ spaces/quoted\"file |
749 call WaitForAssert({-> assert_match('quoted"file', term_getline('', 1))}) | 746 call WaitForAssert({-> assert_match('quoted"file', term_getline('', 1))}) |
750 call term_wait('') | 747 call term_wait('') |
951 let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})" | 948 let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})" |
952 call assert_fails(cmd, 'E474') | 949 call assert_fails(cmd, 'E474') |
953 endfunc | 950 endfunc |
954 | 951 |
955 func Test_terminal_response_to_control_sequence() | 952 func Test_terminal_response_to_control_sequence() |
956 if !has('unix') | 953 CheckUnix |
957 return | |
958 endif | |
959 | 954 |
960 let buf = Run_shell_in_terminal({}) | 955 let buf = Run_shell_in_terminal({}) |
961 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) | 956 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
962 | 957 |
963 call term_sendkeys(buf, "cat\<CR>") | 958 call term_sendkeys(buf, "cat\<CR>") |
1718 tabprev | 1713 tabprev |
1719 tabclose | 1714 tabclose |
1720 endfunc | 1715 endfunc |
1721 | 1716 |
1722 func Test_terminal_out_err() | 1717 func Test_terminal_out_err() |
1723 if !has('unix') | 1718 CheckUnix |
1724 return | 1719 |
1725 endif | |
1726 call writefile([ | 1720 call writefile([ |
1727 \ '#!/bin/sh', | 1721 \ '#!/bin/sh', |
1728 \ 'echo "this is standard error" >&2', | 1722 \ 'echo "this is standard error" >&2', |
1729 \ 'echo "this is standard out" >&1', | 1723 \ 'echo "this is standard out" >&1', |
1730 \ ], 'Xechoerrout.sh') | 1724 \ ], 'Xechoerrout.sh') |
1742 call delete('Xechoerrout.sh') | 1736 call delete('Xechoerrout.sh') |
1743 call delete(outfile) | 1737 call delete(outfile) |
1744 endfunc | 1738 endfunc |
1745 | 1739 |
1746 func Test_terminwinscroll() | 1740 func Test_terminwinscroll() |
1747 if !has('unix') | 1741 CheckUnix |
1748 return | |
1749 endif | |
1750 | 1742 |
1751 " Let the terminal output more than 'termwinscroll' lines, some at the start | 1743 " Let the terminal output more than 'termwinscroll' lines, some at the start |
1752 " will be dropped. | 1744 " will be dropped. |
1753 exe 'set termwinscroll=' . &lines | 1745 exe 'set termwinscroll=' . &lines |
1754 let buf = term_start('/bin/sh') | 1746 let buf = term_start('/bin/sh') |
1846 set guioptions& | 1838 set guioptions& |
1847 call delete(filename) | 1839 call delete(filename) |
1848 endfunc | 1840 endfunc |
1849 | 1841 |
1850 func Test_terminal_hidden() | 1842 func Test_terminal_hidden() |
1851 if !has('unix') | 1843 CheckUnix |
1852 return | 1844 |
1853 endif | |
1854 term ++hidden cat | 1845 term ++hidden cat |
1855 let bnr = bufnr('$') | 1846 let bnr = bufnr('$') |
1856 call assert_equal('terminal', getbufvar(bnr, '&buftype')) | 1847 call assert_equal('terminal', getbufvar(bnr, '&buftype')) |
1857 exe 'sbuf ' . bnr | 1848 exe 'sbuf ' . bnr |
1858 call assert_equal('terminal', &buftype) | 1849 call assert_equal('terminal', &buftype) |
1885 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) | 1876 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
1886 bwipe! | 1877 bwipe! |
1887 endfunc | 1878 endfunc |
1888 | 1879 |
1889 func Test_terminal_hidden_and_close() | 1880 func Test_terminal_hidden_and_close() |
1890 if !has('unix') | 1881 CheckUnix |
1891 return | 1882 |
1892 endif | |
1893 call assert_equal(1, winnr('$')) | 1883 call assert_equal(1, winnr('$')) |
1894 term ++hidden ++close ls | 1884 term ++hidden ++close ls |
1895 let bnr = bufnr('$') | 1885 let bnr = bufnr('$') |
1896 call assert_equal('terminal', getbufvar(bnr, '&buftype')) | 1886 call assert_equal('terminal', getbufvar(bnr, '&buftype')) |
1897 call WaitForAssert({-> assert_false(bufexists(bnr))}) | 1887 call WaitForAssert({-> assert_false(bufexists(bnr))}) |
1931 let term = term_start('false', {'term_finish': 'close'}) | 1921 let term = term_start('false', {'term_finish': 'close'}) |
1932 call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) }) | 1922 call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) }) |
1933 endfunc | 1923 endfunc |
1934 | 1924 |
1935 func Test_term_getcursor() | 1925 func Test_term_getcursor() |
1936 if !has('unix') | 1926 CheckUnix |
1937 return | 1927 |
1938 endif | |
1939 let buf = Run_shell_in_terminal({}) | 1928 let buf = Run_shell_in_terminal({}) |
1940 | 1929 |
1941 " Wait for the shell to display a prompt. | 1930 " Wait for the shell to display a prompt. |
1942 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) | 1931 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
1943 | 1932 |
2022 " 2. 0.5 sec later: leave terminal window, execute "i" | 2011 " 2. 0.5 sec later: leave terminal window, execute "i" |
2023 " 3. 0.5 sec later: clear terminal window, now it's 1 line | 2012 " 3. 0.5 sec later: clear terminal window, now it's 1 line |
2024 " 4. 0.5 sec later: redraw, including statusline (used to trigger bug) | 2013 " 4. 0.5 sec later: redraw, including statusline (used to trigger bug) |
2025 " 4. 0.5 sec later: should be done, clean up | 2014 " 4. 0.5 sec later: should be done, clean up |
2026 func Test_terminal_statusline() | 2015 func Test_terminal_statusline() |
2027 if !has('unix') | 2016 CheckUnix |
2028 return | 2017 |
2029 endif | |
2030 set statusline=x | 2018 set statusline=x |
2031 terminal | 2019 terminal |
2032 let tbuf = bufnr('') | 2020 let tbuf = bufnr('') |
2033 call term_sendkeys(tbuf, "clear; echo a; echo b; sleep 1; clear\n") | 2021 call term_sendkeys(tbuf, "clear; echo a; echo b; sleep 1; clear\n") |
2034 call timer_start(500, { tid -> feedkeys("\<C-w>j", 'tx') }) | 2022 call timer_start(500, { tid -> feedkeys("\<C-w>j", 'tx') }) |
2086 set splitright& | 2074 set splitright& |
2087 only! | 2075 only! |
2088 endfunc | 2076 endfunc |
2089 | 2077 |
2090 func Test_terminal_altscreen() | 2078 func Test_terminal_altscreen() |
2091 if has('win32') | 2079 " somehow doesn't work on MS-Windows |
2092 let cmd = "type Xtext\<CR>" | 2080 CheckUnix |
2093 else | 2081 let cmd = "cat Xtext\<CR>" |
2094 let cmd = "cat Xtext\<CR>" | |
2095 endif | |
2096 | 2082 |
2097 let buf = term_start(&shell, {}) | 2083 let buf = term_start(&shell, {}) |
2098 call writefile(["\<Esc>[?1047h"], 'Xtext') | 2084 call writefile(["\<Esc>[?1047h"], 'Xtext') |
2099 call term_sendkeys(buf, cmd) | 2085 call term_sendkeys(buf, cmd) |
2100 call WaitForAssert({-> assert_equal(1, term_getaltscreen(buf))}) | 2086 call WaitForAssert({-> assert_equal(1, term_getaltscreen(buf))}) |