From 4322021baeefed655ebc345fed8fa019e466728d Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 17 Jan 2017 10:46:32 -0500 Subject: [PATCH 1/2] test: screen: Assert expected row count matches configured screen height When there is a difference in expected vs. actual row count, the user gets a confusing message about being unable to string concat a nil value from screen:expect. This assert makes it clear what the problem is rather than requiring people to dig through the code of screen:expect to determine what happened. --- test/functional/ui/screen.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 2581b36711..b5d29c0200 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -205,6 +205,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. @@ -224,6 +227,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() From e2b031a3423fe34b8a5f0c6a48e4a4db20beda4f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 18 Jan 2017 07:53:10 -0500 Subject: [PATCH 2/2] test: screen_basic: Re-enable min width/height test --- test/functional/ui/screen_basic_spec.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua index d03f98c26f..647cb4bb3b 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -563,11 +563,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(':ls')