From b63cde97f40b962f80ab929036d0eb8c1228b33f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 12 Nov 2017 14:22:35 -0500 Subject: [PATCH] tests: terminal: Assert for SIGWINCH handling before continuing Fixes test failures like test/functional/terminal/cursor_spec.lua @ 62: terminal cursor with number column is positioned correctly when focused ./test/functional/ui/screen.lua:302: Row 2 did not match. Expected: |{7: 1 }tty ready | |*{7: 2 }{1: } | |{7: 3 } | |{7: 4 } | |{7: 5 } | |{7: 6 } | |{3:-- TERMINAL --} | Actual: |{7: 1 }tty ready | |*{7: 2 }rows: 6, cols: 46 | |{7: 3 }{1: } | |{7: 4 } | |{7: 5 } | |{7: 6 } | |{3:-- TERMINAL --} | --- test/functional/terminal/cursor_spec.lua | 17 +++++++++++++---- test/functional/terminal/window_spec.lua | 15 ++++++++++++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index d49f1bfc23..d942723d02 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -50,8 +50,8 @@ describe('terminal cursor', function() it('is positioned correctly when unfocused', function() screen:expect([[ {7: 1 }tty ready | - {7: 2 }{2:^ } | - {7: 3 } | + {7: 2 }^rows: 6, cols: 46 | + {7: 3 }{2: } | {7: 4 } | {7: 5 } | {7: 6 } | @@ -60,12 +60,21 @@ describe('terminal cursor', function() end) it('is positioned correctly when focused', function() + screen:expect([[ + {7: 1 }tty ready | + {7: 2 }^rows: 6, cols: 46 | + {7: 3 }{2: } | + {7: 4 } | + {7: 5 } | + {7: 6 } | + :set number | + ]]) feed('i') helpers.wait() screen:expect([[ {7: 1 }tty ready | - {7: 2 }{1: } | - {7: 3 } | + {7: 2 }rows: 6, cols: 46 | + {7: 3 }{1: } | {7: 4 } | {7: 5 } | {7: 6 } | diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua index 231618c5da..842a81872e 100644 --- a/test/functional/terminal/window_spec.lua +++ b/test/functional/terminal/window_spec.lua @@ -43,14 +43,23 @@ describe('terminal window', function() -- numberwidth=9 feed([[]]) feed([[:set numberwidth=9 numberi]]) + screen:expect([[ + {7: 1 }tty ready | + {7: 2 }rows: 6, cols: 48 | + {7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO| + {7: 4 }WXYZrows: 6, cols: 41 | + {7: 5 }{1: } | + {7: 6 } | + {3:-- TERMINAL --} | + ]]) thelpers.feed_data({' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) screen:expect([[ {7: 1 }tty ready | {7: 2 }rows: 6, cols: 48 | {7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO| - {7: 4 }WXYZ abcdefghijklmnopqrstuvwxyzABCDEFGHIJ| - {7: 5 }KLMNOPQRSTUVWXYZrows: 6, cols: 41 | - {7: 6 }{1: } | + {7: 4 }WXYZrows: 6, cols: 41 | + {7: 5 } abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN| + {7: 6 }OPQRSTUVWXYZ{1: } | {3:-- TERMINAL --} | ]]) end)