aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/cmdline_spec.lua66
-rw-r--r--test/functional/ui/cmdline_spec.lua32
-rw-r--r--test/unit/buffer_spec.lua40
3 files changed, 82 insertions, 56 deletions
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua
new file mode 100644
index 0000000000..9ebe9aeb91
--- /dev/null
+++ b/test/functional/legacy/cmdline_spec.lua
@@ -0,0 +1,66 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local feed = helpers.feed
+local feed_command = helpers.feed_command
+local source = helpers.source
+
+describe('cmdline', function()
+ before_each(clear)
+
+ it('is cleared when switching tabs', function()
+ local screen = Screen.new(30, 10)
+ screen:attach()
+ feed_command([[call setline(1, range(30))]])
+ screen:expect([[
+ ^0 |
+ 1 |
+ 2 |
+ 3 |
+ 4 |
+ 5 |
+ 6 |
+ 7 |
+ 8 |
+ :call setline(1, range(30)) |
+ ]])
+ feed([[:tabnew<cr><C-w>-<C-w>-gtgt]])
+ screen:expect([[
+ + [No Name] [No Name] X|
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ 6 |
+ 7 |
+ |
+ ]])
+ end)
+
+ it('prints every executed Ex command if verbose >= 16', function()
+ local screen = Screen.new(60, 12)
+ screen:attach()
+ source([[
+ command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v
+ call feedkeys("\r", 't') " for the hit-enter prompt
+ set verbose=20
+ ]])
+ feed_command('DoSomething')
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ |
+ Executing: DoSomething |
+ Executing: echo 'hello' |set ts=4 |let v = '123' |echo v |
+ hello |
+ Executing: set ts=4 |let v = '123' |echo v |
+ Executing: let v = '123' |echo v |
+ Executing: echo v |
+ 123 |
+ Press ENTER or type command to continue^ |
+ ]])
+ end)
+end)
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 01f0d8a4d7..21c01b3458 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -3,7 +3,6 @@ local Screen = require('test.functional.ui.screen')
local clear, feed = helpers.clear, helpers.feed
local source = helpers.source
local command = helpers.command
-local feed_command = helpers.feed_command
local function new_screen(opt)
local screen = Screen.new(25, 5)
@@ -843,34 +842,3 @@ describe('cmdline redraw', function()
]], unchanged=true}
end)
end)
-
-describe('cmdline', function()
- before_each(function()
- clear()
- end)
-
- it('prints every executed Ex command if verbose >= 16', function()
- local screen = Screen.new(50, 12)
- screen:attach()
- source([[
- command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v
- call feedkeys("\r", 't') " for the hit-enter prompt
- set verbose=20
- ]])
- feed_command('DoSomething')
- screen:expect([[
- |
- ~ |
- |
- Executing: DoSomething |
- Executing: echo 'hello' |set ts=4 |let v = '123' ||
- echo v |
- hello |
- Executing: set ts=4 |let v = '123' |echo v |
- Executing: let v = '123' |echo v |
- Executing: echo v |
- 123 |
- Press ENTER or type command to continue^ |
- ]])
- end)
-end)
diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua
index bf4e5a0e6d..3692e19379 100644
--- a/test/unit/buffer_spec.lua
+++ b/test/unit/buffer_spec.lua
@@ -212,7 +212,7 @@ describe('buffer functions', function()
describe('build_stl_str_hl', function()
local buffer_byte_size = 100
- local STL_MAX_ITEM = 80
+ local STL_INITIAL_ITEMS = 20
local output_buffer = ''
-- This function builds the statusline
@@ -431,31 +431,23 @@ describe('buffer functions', function()
'aaaa%=b%=c%=d%=e%=fg%=hi%=jk%=lmnop%=qrstuv%=wxyz',
'aaaa b c d e fg hi jk lmnop qrstuv wxyz')
- -- maximum stl item testing
- statusline_test('should handle a much larger amount of = than buffer locations', 20,
- ('%='):rep(STL_MAX_ITEM - 1),
- ' ') -- Should be fine, because within limit
- statusline_test('should handle a much larger amount of = than stl max item', 20,
- ('%='):rep(STL_MAX_ITEM + 1),
- ' E541') -- Should show the VIM error
+ -- stl item testing
+ local tabline = ''
+ for i= 1, 1000 do
+ tabline = tabline .. (i % 2 == 0 and '%#TabLineSel#' or '%#TabLineFill#') .. tostring(i % 2)
+ end
+ statusline_test('should handle a large amount of any items', 20,
+ tabline,
+ '<1010101010101010101') -- Should not show any error
+ statusline_test('should handle a larger amount of = than stl initial item', 20,
+ ('%='):rep(STL_INITIAL_ITEMS * 5),
+ ' ') -- Should not show any error
statusline_test('should handle many extra characters', 20,
- 'a' .. ('a'):rep(STL_MAX_ITEM * 4),
- '<aaaaaaaaaaaaaaaaaaa') -- Does not show the error because there are no items
- statusline_test('should handle almost maximum of characters and flags', 20,
- 'a' .. ('%=a'):rep(STL_MAX_ITEM - 1),
- 'a<aaaaaaaaaaaaaaaaaa') -- Should not show the VIM error
- statusline_test('should handle many extra characters and flags', 20,
- 'a' .. ('%=a'):rep(STL_MAX_ITEM),
- 'a<aaaaaaaaaaaaa E541') -- Should show the VIM error
+ 'a' .. ('a'):rep(STL_INITIAL_ITEMS * 5),
+ '<aaaaaaaaaaaaaaaaaaa') -- Does not show any error
statusline_test('should handle many extra characters and flags', 20,
- 'a' .. ('%=a'):rep(STL_MAX_ITEM * 2),
- 'a<aaaaaaaaaaaaa E541') -- Should show the VIM error
- statusline_test('should handle many extra characters and flags with truncation', 20,
- 'aaa%<' .. ('%=a'):rep(STL_MAX_ITEM),
- 'aaa<aaaaaaaaaaa E541') -- Should show the VIM error
- statusline_test('should handle many characters and flags before and after truncation', 20,
- 'a%=a%=a%<' .. ('%=a'):rep(STL_MAX_ITEM),
- 'aaa<aaaaaaaaaaa E541') -- Should show the VIM error
+ 'a' .. ('%=a'):rep(STL_INITIAL_ITEMS * 2),
+ 'a<aaaaaaaaaaaaaaaaaa') -- Should not show any error
-- multi-byte testing