tests: don't ignore highlights in terminal tests

This commit is contained in:
Björn Linse
2016-08-09 17:01:56 +02:00
parent 4de10d43aa
commit f332eba16c
11 changed files with 247 additions and 255 deletions

View File

@@ -21,7 +21,7 @@ describe('terminal altscreen', function()
line7 | line7 |
line8 | line8 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
enter_altscreen() enter_altscreen()
screen:expect([[ screen:expect([[
@@ -31,7 +31,7 @@ describe('terminal altscreen', function()
| |
| |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(10, curbuf('line_count')) eq(10, curbuf('line_count'))
end) end)
@@ -60,7 +60,7 @@ describe('terminal altscreen', function()
line7 | line7 |
line8 | line8 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('<c-\\><c-n>gg') feed('<c-\\><c-n>gg')
screen:expect([[ screen:expect([[
@@ -86,7 +86,7 @@ describe('terminal altscreen', function()
line15 | line15 |
line16 | line16 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -116,7 +116,7 @@ describe('terminal altscreen', function()
| |
rows: 4, cols: 50 | rows: 4, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end end
@@ -149,7 +149,7 @@ describe('terminal altscreen', function()
line5 | line5 |
line6 | line6 |
line7 | line7 |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)

View File

@@ -21,11 +21,11 @@ describe('terminal buffer', function()
feed('<c-\\><c-n>:set bufhidden=wipe<cr>:enew<cr>') feed('<c-\\><c-n>:set bufhidden=wipe<cr>:enew<cr>')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
:enew | :enew |
]]) ]])
end) end)
@@ -34,11 +34,11 @@ describe('terminal buffer', function()
feed(':bnext:l<esc>') feed(':bnext:l<esc>')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
| |
]]) ]])
end) end)
@@ -78,7 +78,7 @@ describe('terminal buffer', function()
| |
| |
^ | ^ |
E21: Cannot make changes, 'modifiable' is off | {8:E21: Cannot make changes, 'modifiable' is off} |
]]) ]])
end) end)
@@ -138,21 +138,21 @@ describe('terminal buffer', function()
feed('<c-\\><c-n>:bd!<cr>') feed('<c-\\><c-n>:bd!<cr>')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
:bd! | :bd! |
]]) ]])
execute('bnext') execute('bnext')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
:bnext | :bnext |
]]) ]])
end) end)
@@ -180,8 +180,8 @@ describe('terminal buffer', function()
-- We should be in a new buffer now. -- We should be in a new buffer now.
screen:expect([[ screen:expect([[
ab^c | ab^c |
~ | {4:~ }|
========== | {5:========== }|
rows: 2, cols: 50 | rows: 2, cols: 50 |
{2: } | {2: } |
{1:========== }| {1:========== }|

View File

@@ -25,7 +25,7 @@ describe('terminal cursor', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -49,12 +49,12 @@ describe('terminal cursor', function()
it('is positioned correctly when unfocused', function() it('is positioned correctly when unfocused', function()
screen:expect([[ screen:expect([[
1 tty ready | {7: 1 }tty ready |
2 {2: } | {7: 2 }{2: } |
3 | {7: 3 } |
4 | {7: 4 } |
5 | {7: 5 } |
6 ^ | {7: 6 }^ |
:set number | :set number |
]]) ]])
end) end)
@@ -83,7 +83,7 @@ describe('terminal cursor', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
show_cursor() show_cursor()
screen:expect([[ screen:expect([[
@@ -93,7 +93,7 @@ describe('terminal cursor', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
-- same for when the terminal is unfocused -- same for when the terminal is unfocused
feed('<c-\\><c-n>') feed('<c-\\><c-n>')
@@ -132,14 +132,8 @@ describe('cursor with customized highlighting', function()
screen = Screen.new(50, 7) screen = Screen.new(50, 7)
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {foreground = 45, background = 46}, [1] = {foreground = 45, background = 46},
[2] = {foreground = 55, background = 56} [2] = {foreground = 55, background = 56},
}) [3] = {bold = true},
screen:set_default_attr_ignore({
[1] = {bold = true},
[2] = {foreground = 12},
[3] = {bold = true, reverse = true},
[5] = {background = 11},
[6] = {foreground = 130},
}) })
screen:attach(false) screen:attach(false)
execute('call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') execute('call termopen(["'..nvim_dir..'/tty-test"]) | startinsert')
@@ -153,7 +147,7 @@ describe('cursor with customized highlighting', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('<c-\\><c-n>') feed('<c-\\><c-n>')
screen:expect([[ screen:expect([[

View File

@@ -44,14 +44,13 @@ local function screen_setup(extra_height, command)
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {reverse = true}, -- focused cursor [1] = {reverse = true}, -- focused cursor
[2] = {background = 11}, -- unfocused cursor [2] = {background = 11}, -- unfocused cursor
}) [3] = {bold = true},
screen:set_default_attr_ignore({ [4] = {foreground = 12},
[1] = {bold = true}, [5] = {bold = true, reverse = true},
[2] = {foreground = 12}, [6] = {background = 11},
[3] = {bold = true, reverse = true}, [7] = {foreground = 130},
[5] = {background = 11}, [8] = {foreground = 15, background = 1}, -- error message
[6] = {foreground = 130}, [9] = {foreground = 4},
[7] = {foreground = 15, background = 1}, -- error message
}) })
screen:attach(false) screen:attach(false)
@@ -76,7 +75,7 @@ local function screen_setup(extra_height, command)
table.insert(expected, empty_line) table.insert(expected, empty_line)
end end
table.insert(expected, '-- TERMINAL -- ') table.insert(expected, '{3:-- TERMINAL --} ')
screen:expect(table.concat(expected, '\n')) screen:expect(table.concat(expected, '\n'))
else else
wait() wait()

View File

@@ -16,33 +16,32 @@ describe('terminal window highlighting', function()
[1] = {foreground = 45}, [1] = {foreground = 45},
[2] = {background = 46}, [2] = {background = 46},
[3] = {foreground = 45, background = 46}, [3] = {foreground = 45, background = 46},
[4] = {bold = true, italic = true, underline = true} [4] = {bold = true, italic = true, underline = true},
}) [5] = {bold = true},
screen:set_default_attr_ignore({ [6] = {foreground = 12},
[1] = {bold = true}, [7] = {bold = true, reverse = true},
[2] = {foreground = 12},
[3] = {bold = true, reverse = true},
[5] = {background = 11},
[6] = {foreground = 130},
[7] = {reverse = true},
[8] = {background = 11}, [8] = {background = 11},
[9] = {foreground = 130},
[10] = {reverse = true},
[11] = {background = 11},
}) })
screen:attach(false) screen:attach(false)
execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert')
screen:expect([[ screen:expect([[
tty ready | tty ready |
{10: } |
| |
| |
| |
| |
| {5:-- TERMINAL --} |
-- TERMINAL -- |
]]) ]])
end) end)
local function descr(title, attr_num, set_attrs_fn) local function descr(title, attr_num, set_attrs_fn)
local function sub(s) local function sub(s)
return s:gsub('NUM', attr_num) local str = s:gsub('NUM', attr_num)
return str
end end
describe(title, function() describe(title, function()
@@ -54,16 +53,15 @@ describe('terminal window highlighting', function()
end) end)
local function pass_attrs() local function pass_attrs()
local s = sub([[ screen:expect(sub([[
tty ready | tty ready |
{NUM:text}text | {NUM:text}text{10: } |
| |
| |
| |
| |
-- TERMINAL -- | {5:-- TERMINAL --} |
]]) ]]))
screen:expect(s)
end end
it('will pass the corresponding attributes', pass_attrs) it('will pass the corresponding attributes', pass_attrs)
@@ -82,11 +80,11 @@ describe('terminal window highlighting', function()
line6 | line6 |
line7 | line7 |
line8 | line8 |
| {10: } |
-- TERMINAL -- | {5:-- TERMINAL --} |
]]) ]])
feed('<c-\\><c-n>gg') feed('<c-\\><c-n>gg')
local s = sub([[ screen:expect(sub([[
^tty ready | ^tty ready |
{NUM:text}textline1 | {NUM:text}textline1 |
line2 | line2 |
@@ -94,8 +92,7 @@ describe('terminal window highlighting', function()
line4 | line4 |
line5 | line5 |
| |
]]) ]]))
screen:expect(s)
end) end)
end) end)
end end
@@ -121,28 +118,26 @@ describe('terminal window highlighting with custom palette', function()
clear() clear()
screen = Screen.new(50, 7) screen = Screen.new(50, 7)
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {foreground = 1193046, special = Screen.colors.Black} [1] = {foreground = 1193046, special = Screen.colors.Black},
})
screen:set_default_attr_ignore({
[1] = {bold = true},
[2] = {foreground = 12}, [2] = {foreground = 12},
[3] = {bold = true, reverse = true}, [3] = {bold = true, reverse = true},
[5] = {background = 11}, [5] = {background = 11},
[6] = {foreground = 130}, [6] = {foreground = 130},
[7] = {reverse = true}, [7] = {reverse = true},
[8] = {background = 11}, [8] = {background = 11},
[9] = {bold = true},
}) })
screen:attach(true) screen:attach(true)
nvim('set_var', 'terminal_color_3', '#123456') nvim('set_var', 'terminal_color_3', '#123456')
execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert')
screen:expect([[ screen:expect([[
tty ready | tty ready |
{7: } |
| |
| |
| |
| |
| {9:-- TERMINAL --} |
-- TERMINAL -- |
]]) ]])
end) end)
@@ -153,12 +148,12 @@ describe('terminal window highlighting with custom palette', function()
thelpers.feed_data('text') thelpers.feed_data('text')
screen:expect([[ screen:expect([[
tty ready | tty ready |
{1:text}text | {1:text}text{7: } |
| |
| |
| |
| |
-- TERMINAL -- | {9:-- TERMINAL --} |
]]) ]])
end) end)
end) end)

View File

@@ -27,7 +27,7 @@ describe('terminal mouse', function()
line29 | line29 |
line30 | line30 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -74,7 +74,7 @@ describe('terminal mouse', function()
line30 | line30 |
mouse enabled | mouse enabled |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -87,7 +87,7 @@ describe('terminal mouse', function()
line30 | line30 |
mouse enabled | mouse enabled |
"#{1: } | "#{1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -100,7 +100,7 @@ describe('terminal mouse', function()
line30 | line30 |
mouse enabled | mouse enabled |
`!!{1: } | `!!{1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -119,79 +119,79 @@ describe('terminal mouse', function()
]]) ]])
feed(':enew | set number<cr>') feed(':enew | set number<cr>')
screen:expect([[ screen:expect([[
1 ^ |line28 | {7: 1 }^ |line28 |
~ |line29 | {4:~ }|line29 |
~ |line30 | {4:~ }|line30 |
~ |rows: 5, cols: 25 | {4:~ }|rows: 5, cols: 25 |
~ |{2: } | {4:~ }|{2: } |
========== ========== | ========== ========== |
:enew | set number | :enew | set number |
]]) ]])
feed('30iline\n<esc>') feed('30iline\n<esc>')
screen:expect([[ screen:expect([[
27 line |line28 | {7: 27 }line |line28 |
28 line |line29 | {7: 28 }line |line29 |
29 line |line30 | {7: 29 }line |line30 |
30 line |rows: 5, cols: 25 | {7: 30 }line |rows: 5, cols: 25 |
31 ^ |{2: } | {7: 31 }^ |{2: } |
========== ========== | ========== ========== |
| |
]]) ]])
feed('<c-w>li') feed('<c-w>li')
screen:expect([[ screen:expect([[
27 line |line29 | {7: 27 }line |line29 |
28 line |line30 | {7: 28 }line |line30 |
29 line |rows: 5, cols: 25 | {7: 29 }line |rows: 5, cols: 25 |
30 line |rows: 5, cols: 24 | {7: 30 }line |rows: 5, cols: 24 |
31 |{1: } | {7: 31 } |{1: } |
========== ========== | ========== ========== |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
-- enabling mouse won't affect interaction with other windows -- enabling mouse won't affect interaction with other windows
thelpers.enable_mouse() thelpers.enable_mouse()
thelpers.feed_data('mouse enabled\n') thelpers.feed_data('mouse enabled\n')
screen:expect([[ screen:expect([[
27 line |line30 | {7: 27 }line |line30 |
28 line |rows: 5, cols: 25 | {7: 28 }line |rows: 5, cols: 25 |
29 line |rows: 5, cols: 24 | {7: 29 }line |rows: 5, cols: 24 |
30 line |mouse enabled | {7: 30 }line |mouse enabled |
31 |{1: } | {7: 31 } |{1: } |
========== ========== | ========== ========== |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
it('wont lose focus if another window is scrolled', function() it('wont lose focus if another window is scrolled', function()
feed('<MouseDown><0,0><MouseDown><0,0>') feed('<MouseDown><0,0><MouseDown><0,0>')
screen:expect([[ screen:expect([[
21 line |line30 | {7: 21 }line |line30 |
22 line |rows: 5, cols: 25 | {7: 22 }line |rows: 5, cols: 25 |
23 line |rows: 5, cols: 24 | {7: 23 }line |rows: 5, cols: 24 |
24 line |mouse enabled | {7: 24 }line |mouse enabled |
25 line |{1: } | {7: 25 }line |{1: } |
========== ========== | ========== ========== |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('<S-MouseUp><0,0>') feed('<S-MouseUp><0,0>')
screen:expect([[ screen:expect([[
26 line |line30 | {7: 26 }line |line30 |
27 line |rows: 5, cols: 25 | {7: 27 }line |rows: 5, cols: 25 |
28 line |rows: 5, cols: 24 | {7: 28 }line |rows: 5, cols: 24 |
29 line |mouse enabled | {7: 29 }line |mouse enabled |
30 line |{1: } | {7: 30 }line |{1: } |
========== ========== | ========== ========== |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
it('will lose focus if another window is clicked', function() it('will lose focus if another window is clicked', function()
feed('<LeftMouse><5,1>') feed('<LeftMouse><5,1>')
screen:expect([[ screen:expect([[
27 line |line30 | {7: 27 }line |line30 |
28 l^ine |rows: 5, cols: 25 | {7: 28 }l^ine |rows: 5, cols: 25 |
29 line |rows: 5, cols: 24 | {7: 29 }line |rows: 5, cols: 24 |
30 line |mouse enabled | {7: 30 }line |mouse enabled |
31 |{2: } | {7: 31 } |{2: } |
========== ========== | ========== ========== |
| |
]]) ]])

View File

@@ -33,7 +33,7 @@ describe('terminal scrollback', function()
line29 | line29 |
line30 | line30 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -61,7 +61,7 @@ describe('terminal scrollback', function()
line3 | line3 |
line4 | line4 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -76,7 +76,7 @@ describe('terminal scrollback', function()
line4 | line4 |
line5 | line5 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(7, curbuf('line_count')) eq(7, curbuf('line_count'))
end) end)
@@ -92,7 +92,7 @@ describe('terminal scrollback', function()
line6 | line6 |
line7 | line7 |
line8{1: } | line8{1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('<c-\\><c-n>6k') feed('<c-\\><c-n>6k')
@@ -141,7 +141,7 @@ describe('terminal scrollback', function()
line4 | line4 |
rows: 5, cols: 50 | rows: 5, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end end
@@ -158,7 +158,7 @@ describe('terminal scrollback', function()
rows: 5, cols: 50 | rows: 5, cols: 50 |
rows: 3, cols: 50 | rows: 3, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(8, curbuf('line_count')) eq(8, curbuf('line_count'))
feed('<c-\\><c-n>3k') feed('<c-\\><c-n>3k')
@@ -185,7 +185,7 @@ describe('terminal scrollback', function()
rows: 4, cols: 50 | rows: 4, cols: 50 |
{1: } | {1: } |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(4, curbuf('line_count')) eq(4, curbuf('line_count'))
end end
@@ -203,7 +203,7 @@ describe('terminal scrollback', function()
rows: 4, cols: 50 | rows: 4, cols: 50 |
rows: 3, cols: 50 | rows: 3, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(4, curbuf('line_count')) eq(4, curbuf('line_count'))
feed('<c-\\><c-n>gg') feed('<c-\\><c-n>gg')
@@ -218,7 +218,7 @@ describe('terminal scrollback', function()
rows: 4, cols: 50 | rows: 4, cols: 50 |
rows: 3, cols: 50 | rows: 3, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -235,14 +235,14 @@ describe('terminal scrollback', function()
line3 | line3 |
line4 | line4 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
screen:try_resize(screen._width, screen._height - 3) screen:try_resize(screen._width, screen._height - 3)
screen:expect([[ screen:expect([[
line4 | line4 |
rows: 3, cols: 50 | rows: 3, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(7, curbuf('line_count')) eq(7, curbuf('line_count'))
end) end)
@@ -255,7 +255,7 @@ describe('terminal scrollback', function()
rows: 3, cols: 50 | rows: 3, cols: 50 |
rows: 4, cols: 50 | rows: 4, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end end
@@ -277,7 +277,7 @@ describe('terminal scrollback', function()
rows: 4, cols: 50 | rows: 4, cols: 50 |
rows: 7, cols: 50 | rows: 7, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(9, curbuf('line_count')) eq(9, curbuf('line_count'))
feed('<c-\\><c-n>gg') feed('<c-\\><c-n>gg')
@@ -315,7 +315,7 @@ describe('terminal scrollback', function()
rows: 11, cols: 50 | rows: 11, cols: 50 |
{1: } | {1: } |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
-- since there's an empty line after the cursor, the buffer line -- since there's an empty line after the cursor, the buffer line
-- count equals the terminal screen height -- count equals the terminal screen height

View File

@@ -17,12 +17,12 @@ describe('tui', function()
screen.timeout = 60000 screen.timeout = 60000
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -36,20 +36,20 @@ describe('tui', function()
abc | abc |
test1 | test1 |
test2{1: } | test2{1: } |
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027') feed('\027')
screen:expect([[ screen:expect([[
abc | abc |
test1 | test1 |
test{1:2} | test{1:2} |
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -64,9 +64,9 @@ describe('tui', function()
alt-k | alt-k |
alt-l | alt-l |
{1: } | {1: } |
[No Name] [+] | {5:[No Name] [+] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('gg') feed('gg')
screen:expect([[ screen:expect([[
@@ -74,9 +74,9 @@ describe('tui', function()
alt-f | alt-f |
alt-g | alt-g |
alt-h | alt-h |
[No Name] [+] | {5:[No Name] [+] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -90,12 +90,12 @@ describe('tui', function()
feed('i\027j') feed('i\027j')
screen:expect([[ screen:expect([[
j{1: } | j{1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -105,46 +105,46 @@ describe('tui', function()
feed('\022\022') -- ctrl+v feed('\022\022') -- ctrl+v
feed('\022\013') -- ctrl+m feed('\022\013') -- ctrl+m
screen:expect([[ screen:expect([[
{3:^G^V^M}{1: } | {9:^G^V^M}{1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]], {[1] = {reverse = true}, [2] = {background = 11}, [3] = {foreground = 4}}) ]])
end) end)
it('automatically sends <Paste> for bracketed paste sequences', function() it('automatically sends <Paste> for bracketed paste sequences', function()
feed('i\027[200~') feed('i\027[200~')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
-- INSERT (paste) -- | {3:-- INSERT (paste) --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('pasted from terminal') feed('pasted from terminal')
screen:expect([[ screen:expect([[
pasted from terminal{1: } | pasted from terminal{1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT (paste) -- | {3:-- INSERT (paste) --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[201~') feed('\027[201~')
screen:expect([[ screen:expect([[
pasted from terminal{1: } | pasted from terminal{1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -160,9 +160,9 @@ describe('tui', function()
item 2998 | item 2998 |
item 2999 | item 2999 |
item 3000{1: } | item 3000{1: } |
[No Name] [+] 3000,10 Bot| {5:[No Name] [+] 3000,10 Bot}|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -176,17 +176,15 @@ describe('tui with non-tty file descriptors', function()
it('can handle pipes as stdout and stderr', function() it('can handle pipes as stdout and stderr', function()
local screen = thelpers.screen_setup(0, '"'..helpers.nvim_prog..' -u NONE -i NONE --cmd \'set noswapfile\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"') local screen = thelpers.screen_setup(0, '"'..helpers.nvim_prog..' -u NONE -i NONE --cmd \'set noswapfile\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"')
screen:set_default_attr_ids({})
screen:set_default_attr_ignore(true)
feed(':w testF\n:q\n') feed(':w testF\n:q\n')
screen:expect([[ screen:expect([[
:w testF | :w testF |
:q | :q |
abc | abc |
| |
[Process exited 0] | [Process exited 0]{1: } |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -205,23 +203,23 @@ describe('tui focus event handling', function()
feed('\027[I') feed('\027[I')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
gained | gained |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[O') feed('\027[O')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
lost | lost |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -231,22 +229,22 @@ describe('tui focus event handling', function()
feed('\027[I') feed('\027[I')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
gained | gained |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[O') feed('\027[O')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
lost | lost |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -255,22 +253,22 @@ describe('tui focus event handling', function()
feed('\027[I') feed('\027[I')
screen:expect([[ screen:expect([[
| |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
g{1:a}ined | g{1:a}ined |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[O') feed('\027[O')
screen:expect([[ screen:expect([[
| |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
l{1:o}st | l{1:o}st |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -287,7 +285,7 @@ describe('tui focus event handling', function()
| |
| |
gained | gained |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[O') feed('\027[O')
screen:expect([[ screen:expect([[
@@ -297,7 +295,7 @@ describe('tui focus event handling', function()
| |
| |
lost | lost |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -319,15 +317,21 @@ describe("tui 't_Co' (terminal colors)", function()
helpers.nvim_prog)) helpers.nvim_prog))
thelpers.feed_data(":echo &t_Co\n") thelpers.feed_data(":echo &t_Co\n")
local tline
if maxcolors == 8 then
tline = "~ "
else
tline = "{4:~ }"
end
screen:expect(string.format([[ screen:expect(string.format([[
{1: } | {1: } |
~ | %s|
~ | %s|
~ | %s|
[No Name] | {5:[No Name] }|
%-3s | %-3s |
-- TERMINAL -- | {3:-- TERMINAL --} |
]], tostring(maxcolors and maxcolors or ""))) ]], tline, tline, tline, tostring(maxcolors and maxcolors or "")))
end end
it("unknown TERM sets empty 't_Co'", function() it("unknown TERM sets empty 't_Co'", function()

View File

@@ -52,7 +52,7 @@ describe('terminal window', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -68,7 +68,7 @@ describe('terminal window', function()
line3 | line3 |
line4 | line4 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)

View File

@@ -32,8 +32,8 @@ describe('terminal', function()
tty ready | tty ready |
rows: 2, cols: 50 | rows: 2, cols: 50 |
{2: } | {2: } |
~ | {4:~ }|
~ | {4:~ }|
========== | ========== |
| |
]]) ]])
@@ -58,8 +58,8 @@ describe('terminal', function()
rows: 5, cols: 50 | rows: 5, cols: 50 |
rows: 2, cols: 50 | rows: 2, cols: 50 |
{2: } | {2: } |
~ | {4:~ }|
~ | {4:~ }|
========== | ========== |
:wincmd p | :wincmd p |
]]) ]])
@@ -83,7 +83,7 @@ describe('terminal', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
screen:try_resize(screen._width - 6, screen._height - 10) screen:try_resize(screen._width - 6, screen._height - 10)
screen:expect([[ screen:expect([[
@@ -91,7 +91,7 @@ describe('terminal', function()
rows: 14, cols: 53 | rows: 14, cols: 53 |
rows: 4, cols: 47 | rows: 4, cols: 47 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)

View File

@@ -9,12 +9,12 @@ describe("shell command :!", function()
'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]') '", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -27,13 +27,13 @@ describe("shell command :!", function()
-- to avoid triggering a UI flush. -- to avoid triggering a UI flush.
child_session.feed_data(":!printf foo; sleep 200\n") child_session.feed_data(":!printf foo; sleep 200\n")
screen:expect([[ screen:expect([[
~ | {1: } |
~ | {4:~ }|
[No Name] | {4:~ }|
:!printf foo; sleep 200 | {4:~ }|
{5:[No Name] }|
| |
foo | {3:-- TERMINAL --} |
-- TERMINAL -- |
]]) ]])
end) end)
end) end)