Mercurial > vim
comparison src/testdir/test_terminal.vim @ 27098:8bb07c88ac27 v8.2.4078
patch 8.2.4078: terminal test for current directory not used on FreeBSD
Commit: https://github.com/vim/vim/commit/ced2b38a560cc4f4ec983ed2cf4372ab62e1dbc1
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 13 15:25:32 2022 +0000
patch 8.2.4078: terminal test for current directory not used on FreeBSD
Problem: Terminal test for current directory not used on FreeBSD.
Solution: Make it work on FreeBSD. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/9516) Add
TermWait() inside Run_shell_in_terminal() as a generic solution.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Jan 2022 16:30:04 +0100 |
parents | b3ac5a4dc158 |
children | 68c33419fdc6 |
comparison
equal
deleted
inserted
replaced
27097:6612e555c1c0 | 27098:8bb07c88ac27 |
---|---|
24 call assert_notmatch('%[^\n]*running]', execute('ls F')) | 24 call assert_notmatch('%[^\n]*running]', execute('ls F')) |
25 call assert_notmatch('%[^\n]*running]', execute('ls ?')) | 25 call assert_notmatch('%[^\n]*running]', execute('ls ?')) |
26 call assert_fails('set modifiable', 'E946:') | 26 call assert_fails('set modifiable', 'E946:') |
27 | 27 |
28 call StopShellInTerminal(buf) | 28 call StopShellInTerminal(buf) |
29 call TermWait(buf) | |
30 call assert_equal('n', mode()) | 29 call assert_equal('n', mode()) |
31 call assert_match('%aF[^\n]*finished]', execute('ls')) | 30 call assert_match('%aF[^\n]*finished]', execute('ls')) |
32 call assert_match('%aF[^\n]*finished]', execute('ls F')) | 31 call assert_match('%aF[^\n]*finished]', execute('ls F')) |
33 call assert_notmatch('%[^\n]*finished]', execute('ls R')) | 32 call assert_notmatch('%[^\n]*finished]', execute('ls R')) |
34 call assert_notmatch('%[^\n]*finished]', execute('ls ?')) | 33 call assert_notmatch('%[^\n]*finished]', execute('ls ?')) |
46 call assert_match('^!', bufname(buf)) | 45 call assert_match('^!', bufname(buf)) |
47 0file | 46 0file |
48 call assert_equal("", bufname(buf)) | 47 call assert_equal("", bufname(buf)) |
49 call assert_match('\[No Name\]', execute('file')) | 48 call assert_match('\[No Name\]', execute('file')) |
50 call StopShellInTerminal(buf) | 49 call StopShellInTerminal(buf) |
51 call TermWait(buf) | |
52 endfunc | 50 endfunc |
53 | 51 |
54 func Test_terminal_TerminalWinOpen() | 52 func Test_terminal_TerminalWinOpen() |
55 au TerminalWinOpen * let b:done = 'yes' | 53 au TerminalWinOpen * let b:done = 'yes' |
56 let buf = Run_shell_in_terminal({}) | 54 let buf = Run_shell_in_terminal({}) |
69 endfunc | 67 endfunc |
70 | 68 |
71 func Test_terminal_make_change() | 69 func Test_terminal_make_change() |
72 let buf = Run_shell_in_terminal({}) | 70 let buf = Run_shell_in_terminal({}) |
73 call StopShellInTerminal(buf) | 71 call StopShellInTerminal(buf) |
74 call TermWait(buf) | |
75 | 72 |
76 setlocal modifiable | 73 setlocal modifiable |
77 exe "normal Axxx\<Esc>" | 74 exe "normal Axxx\<Esc>" |
78 call assert_fails(buf . 'bwipe', 'E89:') | 75 call assert_fails(buf . 'bwipe', 'E89:') |
79 undo | 76 undo |
107 unlet g:job | 104 unlet g:job |
108 endfunc | 105 endfunc |
109 | 106 |
110 func Test_terminal_split_quit() | 107 func Test_terminal_split_quit() |
111 let buf = Run_shell_in_terminal({}) | 108 let buf = Run_shell_in_terminal({}) |
112 call TermWait(buf) | |
113 split | 109 split |
114 quit! | 110 quit! |
115 call TermWait(buf) | 111 call TermWait(buf) |
116 sleep 50m | 112 sleep 50m |
117 call assert_equal('run', job_status(g:job)) | 113 call assert_equal('run', job_status(g:job)) |
361 call WaitForAssert({-> assert_match( '149', term_getline(buf, rows - 1) . term_getline(buf, rows - 2))}) | 357 call WaitForAssert({-> assert_match( '149', term_getline(buf, rows - 1) . term_getline(buf, rows - 2))}) |
362 let lines = line('$') | 358 let lines = line('$') |
363 call assert_inrange(91, 100, lines) | 359 call assert_inrange(91, 100, lines) |
364 | 360 |
365 call StopShellInTerminal(buf) | 361 call StopShellInTerminal(buf) |
366 call TermWait(buf) | |
367 exe buf . 'bwipe' | 362 exe buf . 'bwipe' |
368 set termwinscroll& | 363 set termwinscroll& |
369 call delete('Xtext') | 364 call delete('Xtext') |
370 endfunc | 365 endfunc |
371 | 366 |
749 endif | 744 endif |
750 call assert_match('done', line) | 745 call assert_match('done', line) |
751 | 746 |
752 let g:job = term_getjob(buf) | 747 let g:job = term_getjob(buf) |
753 call StopShellInTerminal(buf) | 748 call StopShellInTerminal(buf) |
754 call TermWait(buf) | |
755 unlet g:job | 749 unlet g:job |
756 bwipe | 750 bwipe |
757 endfunc | 751 endfunc |
758 | 752 |
759 func Test_terminal_write_stdin() | 753 func Test_terminal_write_stdin() |
932 call assert_match('456', term_getline(buf, lnum)) | 926 call assert_match('456', term_getline(buf, lnum)) |
933 endif | 927 endif |
934 | 928 |
935 call term_sendkeys(buf, "\r") | 929 call term_sendkeys(buf, "\r") |
936 call StopShellInTerminal(buf) | 930 call StopShellInTerminal(buf) |
937 call TermWait(buf) | |
938 | 931 |
939 tunmap 123 | 932 tunmap 123 |
940 tunmap 456 | 933 tunmap 456 |
941 call assert_equal('', maparg('123', 't')) | 934 call assert_equal('', maparg('123', 't')) |
942 close | 935 close |
950 | 943 |
951 func Test_terminal_wall() | 944 func Test_terminal_wall() |
952 let buf = Run_shell_in_terminal({}) | 945 let buf = Run_shell_in_terminal({}) |
953 wall | 946 wall |
954 call StopShellInTerminal(buf) | 947 call StopShellInTerminal(buf) |
955 call TermWait(buf) | |
956 exe buf . 'bwipe' | 948 exe buf . 'bwipe' |
957 unlet g:job | 949 unlet g:job |
958 endfunc | 950 endfunc |
959 | 951 |
960 func Test_terminal_wqall() | 952 func Test_terminal_wqall() |
961 let buf = Run_shell_in_terminal({}) | 953 let buf = Run_shell_in_terminal({}) |
962 call assert_fails('wqall', 'E948:') | 954 call assert_fails('wqall', 'E948:') |
963 call StopShellInTerminal(buf) | 955 call StopShellInTerminal(buf) |
964 call TermWait(buf) | |
965 exe buf . 'bwipe' | 956 exe buf . 'bwipe' |
966 unlet g:job | 957 unlet g:job |
967 endfunc | 958 endfunc |
968 | 959 |
969 func Test_terminal_composing_unicode() | 960 func Test_terminal_composing_unicode() |
1999 \] | 1990 \] |
2000 | 1991 |
2001 let buf = Run_shell_in_terminal({}) | 1992 let buf = Run_shell_in_terminal({}) |
2002 call assert_equal(colors, term_getansicolors(buf)) | 1993 call assert_equal(colors, term_getansicolors(buf)) |
2003 call StopShellInTerminal(buf) | 1994 call StopShellInTerminal(buf) |
2004 call TermWait(buf) | |
2005 call assert_equal([], term_getansicolors(buf)) | 1995 call assert_equal([], term_getansicolors(buf)) |
2006 | 1996 |
2007 exe buf . 'bwipe' | 1997 exe buf . 'bwipe' |
2008 endfunc | 1998 endfunc |
2009 | 1999 |
2024 | 2014 |
2025 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) | 2015 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) |
2026 let buf = Run_shell_in_terminal({}) | 2016 let buf = Run_shell_in_terminal({}) |
2027 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) | 2017 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) |
2028 call StopShellInTerminal(buf) | 2018 call StopShellInTerminal(buf) |
2029 call TermWait(buf) | |
2030 | 2019 |
2031 exe buf . 'bwipe' | 2020 exe buf . 'bwipe' |
2032 unlet g:terminal_ansi_colors | 2021 unlet g:terminal_ansi_colors |
2033 endfunc | 2022 endfunc |
2034 | 2023 |
2058 let colors[4] = 'Invalid' | 2047 let colors[4] = 'Invalid' |
2059 call assert_fails('call term_setansicolors(buf, colors)', 'E254:') | 2048 call assert_fails('call term_setansicolors(buf, colors)', 'E254:') |
2060 call assert_fails('call term_setansicolors(buf, {})', 'E714:') | 2049 call assert_fails('call term_setansicolors(buf, {})', 'E714:') |
2061 | 2050 |
2062 call StopShellInTerminal(buf) | 2051 call StopShellInTerminal(buf) |
2063 call TermWait(buf) | |
2064 call assert_equal(0, term_setansicolors(buf, [])) | 2052 call assert_equal(0, term_setansicolors(buf, [])) |
2065 exe buf . 'bwipe' | 2053 exe buf . 'bwipe' |
2066 endfunc | 2054 endfunc |
2067 | 2055 |
2068 func Test_terminal_all_ansi_colors() | 2056 func Test_terminal_all_ansi_colors() |