aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-01-18 15:16:07 -0500
committerGitHub <noreply@github.com>2017-01-18 15:16:07 -0500
commit75e6af44e03e706df896df8b57d8e29c9a0d0f41 (patch)
tree7a95e954fefc4c7abc75e751e0bb355a9685b68a
parent2ee60e5b28fbe27e128305858937ca5d6aa0031e (diff)
parente2b031a3423fe34b8a5f0c6a48e4a4db20beda4f (diff)
downloadrneovim-75e6af44e03e706df896df8b57d8e29c9a0d0f41.tar.gz
rneovim-75e6af44e03e706df896df8b57d8e29c9a0d0f41.tar.bz2
rneovim-75e6af44e03e706df896df8b57d8e29c9a0d0f41.zip
Merge pull request #5963 from jamessan/screen-expect-clarity
test: screen: Assert expected row count matches configured screen height
-rw-r--r--test/functional/ui/screen.lua8
-rw-r--r--test/functional/ui/screen_basic_spec.lua5
2 files changed, 10 insertions, 3 deletions
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index fce53f5c8a..ef1f0783e7 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -170,6 +170,9 @@ end
function Screen:try_resize(columns, rows)
uimeths.try_resize(columns, rows)
+ -- Give ourselves a chance to _handle_resize, which requires using
+ -- self.sleep() (for the resize notification) rather than run()
+ self:sleep(0.1)
end
-- Asserts that `expected` eventually matches the screen state.
@@ -195,6 +198,11 @@ function Screen:expect(expected, attr_ids, attr_ignore, condition, any)
row = row:sub(1, #row - 1)
table.insert(expected_rows, row)
end
+ if not any then
+ assert(self._height == #expected_rows,
+ "Expected screen state's row count(" .. #expected_rows
+ .. ') differs from configured height(' .. self._height .. ') of Screen.')
+ end
local ids = attr_ids or self._default_attr_ids
local ignore = attr_ignore or self._default_attr_ignore
self:wait(function()
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 12c6818f7d..0824585717 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -562,11 +562,10 @@ describe('Screen', function()
]])
end)
- -- FIXME this has some race conditions that cause it to fail periodically
- pending('has minimum width/height values', function()
+ it('has minimum width/height values', function()
screen:try_resize(1, 1)
screen:expect([[
- -- INS^ERT --|
+ {2:-- INS^ERT --}|
|
]])
feed('<esc>:ls')