aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/memory_usage_spec.lua12
-rw-r--r--test/functional/terminal/tui_spec.lua2
-rw-r--r--test/functional/ui/diff_spec.lua77
-rw-r--r--test/functional/ui/spell_spec.lua31
4 files changed, 117 insertions, 5 deletions
diff --git a/test/functional/legacy/memory_usage_spec.lua b/test/functional/legacy/memory_usage_spec.lua
index 28ca749749..251e6a5ea4 100644
--- a/test/functional/legacy/memory_usage_spec.lua
+++ b/test/functional/legacy/memory_usage_spec.lua
@@ -7,6 +7,9 @@ local iswin = helpers.iswin
local retry = helpers.retry
local ok = helpers.ok
local source = helpers.source
+local wait = helpers.wait
+local uname = helpers.uname
+local load_adjust = helpers.load_adjust
local monitor_memory_usage = {
memory_usage = function(self)
@@ -99,6 +102,7 @@ describe('memory usage', function()
call s:f(0)
endfor
]])
+ wait()
local after = monitor_memory_usage(pid)
-- Estimate the limit of max usage as 2x initial usage.
-- The lower limit can fluctuate a bit, use 97%.
@@ -143,16 +147,20 @@ describe('memory usage', function()
call s:f()
endfor
]])
+ wait()
local after = monitor_memory_usage(pid)
for _ = 1, 3 do
feed_command('so '..fname)
+ wait()
end
local last = monitor_memory_usage(pid)
-- The usage may be a bit less than the last value, use 80%.
-- Allow for 20% tolerance at the upper limit. That's very permissive, but
- -- otherwise the test fails sometimes.
+ -- otherwise the test fails sometimes. On Sourcehut CI with FreeBSD we need to
+ -- be even more permissive.
+ local upper_multiplier = uname() == 'freebsd' and 15 or 12
local lower = before.last * 8 / 10
- local upper = (after.max + (after.last - before.last)) * 12 / 10
+ local upper = load_adjust((after.max + (after.last - before.last)) * upper_multiplier / 10)
check_result({before=before, after=after, last=last},
pcall(ok, lower < last.last))
check_result({before=before, after=after, last=last},
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 5d82037f42..c0578c08e1 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -605,6 +605,8 @@ describe('TUI', function()
wait_for_mode('i')
-- "bracketed paste"
feed_data('\027[200~'..expected..'\027[201~')
+ -- FIXME: Data race between the two feeds
+ if uname() == 'freebsd' then screen:sleep(1) end
feed_data(' end')
expected = expected..' end'
screen:expect([[
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
index 252991aca7..69b6ab8cf0 100644
--- a/test/functional/ui/diff_spec.lua
+++ b/test/functional/ui/diff_spec.lua
@@ -6,6 +6,7 @@ local clear = helpers.clear
local command = helpers.command
local insert = helpers.insert
local write_file = helpers.write_file
+local source = helpers.source
describe('Diff mode screen', function()
local fname = 'Xtest-functional-diff-screen-1'
@@ -1031,3 +1032,79 @@ it('win_update redraws lines properly', function()
|
]]}
end)
+
+it('diff updates line numbers below filler lines', function()
+ clear()
+ local screen = Screen.new(40, 14)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
+ [2] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
+ [3] = {reverse = true},
+ [4] = {background = Screen.colors.LightBlue},
+ [5] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey},
+ [6] = {bold = true, foreground = Screen.colors.Blue1},
+ [7] = {bold = true, reverse = true},
+ [8] = {bold = true, background = Screen.colors.Red},
+ [9] = {background = Screen.colors.LightMagenta},
+ [10] = {bold = true, foreground = Screen.colors.Brown},
+ [11] = {foreground = Screen.colors.Brown},
+ })
+ source([[
+ call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
+ vnew
+ call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
+ windo diffthis
+ setlocal number rnu foldcolumn=0
+ ]])
+ screen:expect([[
+ {1: }a {3:│}{10:1 }^a |
+ {1: }a {3:│}{11: 1 }a |
+ {1: }a {3:│}{11: 2 }a |
+ {1: }{8:x}{9: }{3:│}{11: 3 }{8:y}{9: }|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }b {3:│}{11: 4 }b |
+ {1: }b {3:│}{11: 5 }b |
+ {1: }b {3:│}{11: 6 }b |
+ {1: }b {3:│}{11: 7 }b |
+ {1: }b {3:│}{11: 8 }b |
+ {6:~ }{3:│}{6:~ }|
+ {3:[No Name] [+] }{7:[No Name] [+] }|
+ |
+ ]])
+ feed('j')
+ screen:expect([[
+ {1: }a {3:│}{11: 1 }a |
+ {1: }a {3:│}{10:2 }^a |
+ {1: }a {3:│}{11: 1 }a |
+ {1: }{8:x}{9: }{3:│}{11: 2 }{8:y}{9: }|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }b {3:│}{11: 3 }b |
+ {1: }b {3:│}{11: 4 }b |
+ {1: }b {3:│}{11: 5 }b |
+ {1: }b {3:│}{11: 6 }b |
+ {1: }b {3:│}{11: 7 }b |
+ {6:~ }{3:│}{6:~ }|
+ {3:[No Name] [+] }{7:[No Name] [+] }|
+ |
+ ]])
+ feed('j')
+ screen:expect([[
+ {1: }a {3:│}{11: 2 }a |
+ {1: }a {3:│}{11: 1 }a |
+ {1: }a {3:│}{10:3 }^a |
+ {1: }{8:x}{9: }{3:│}{11: 1 }{8:y}{9: }|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }b {3:│}{11: 2 }b |
+ {1: }b {3:│}{11: 3 }b |
+ {1: }b {3:│}{11: 4 }b |
+ {1: }b {3:│}{11: 5 }b |
+ {1: }b {3:│}{11: 6 }b |
+ {6:~ }{3:│}{6:~ }|
+ {3:[No Name] [+] }{7:[No Name] [+] }|
+ |
+ ]])
+end)
diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua
index 243b737583..2c6e586665 100644
--- a/test/functional/ui/spell_spec.lua
+++ b/test/functional/ui/spell_spec.lua
@@ -4,8 +4,9 @@ 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 insert = helpers.insert
+local uname = helpers.uname
+local command = helpers.command
describe("'spell'", function()
local screen
@@ -16,12 +17,14 @@ describe("'spell'", function()
screen:attach()
screen:set_default_attr_ids( {
[0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {special = Screen.colors.Red, undercurl = true}
+ [1] = {special = Screen.colors.Red, undercurl = true},
+ [2] = {special = Screen.colors.Blue1, undercurl = true},
})
end)
it('joins long lines #7937', function()
- feed_command('set spell')
+ if uname() == 'openbsd' then pending('FIXME #12104', function() end) return end
+ command('set spell')
insert([[
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
@@ -42,4 +45,26 @@ describe("'spell'", function()
|
]])
end)
+
+ it('has correct highlight at start of line', function()
+ insert([[
+ "This is some text without any spell errors. Everything",
+ "should just be black, nothing wrong here.",
+ "",
+ "This line has a sepll error. and missing caps.",
+ "And and this is the the duplication.",
+ "with missing caps here.",
+ ]])
+ command('set spell spelllang=en_nz')
+ screen:expect([[
+ "This is some text without any spell errors. Everything", |
+ "should just be black, nothing wrong here.", |
+ "", |
+ "This line has a {1:sepll} error. {2:and} missing caps.", |
+ "{1:And and} this is {1:the the} duplication.", |
+ "with missing caps here.", |
+ ^ |
+ |
+ ]])
+ end)
end)