From e336251f2b09932219ed61eab1596033e35d14b9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 21 Jan 2023 17:11:02 +0800 Subject: test(tui_spec): make rapid resize test test what it wants to test (#21933) Actually execute the command. Don't use assert_alive() as it checks the host session instead of the child session. Use screen:expect() instead. --- test/functional/terminal/tui_spec.lua | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'test/functional') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 55bf50e2e0..c4717ae7ee 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -7,7 +7,6 @@ local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') local Screen = require('test.functional.ui.screen') -local assert_alive = helpers.assert_alive local eq = helpers.eq local feed_command = helpers.feed_command local feed_data = thelpers.feed_data @@ -77,7 +76,16 @@ describe('TUI', function() it('rapid resize #7572 #7628', function() -- Need buffer rows to provoke the behavior. - feed_data(":edit test/functional/fixtures/bigfile.txt:") + feed_data(":edit test/functional/fixtures/bigfile.txt\n") + screen:expect([[ + {1:0}000;;Cc;0;BN;;;;;N;NULL;;;; | + 0001;;Cc;0;BN;;;;;N;START OF HEADING;;;; | + 0002;;Cc;0;BN;;;;;N;START OF TEXT;;;; | + 0003;;Cc;0;BN;;;;;N;END OF TEXT;;;; | + {5:test/functional/fixtures/bigfile.txt }| + :edit test/functional/fixtures/bigfile.txt | + {3:-- TERMINAL --} | + ]]) command('call jobresize(b:terminal_job_id, 58, 9)') command('call jobresize(b:terminal_job_id, 62, 13)') command('call jobresize(b:terminal_job_id, 100, 42)') @@ -94,7 +102,25 @@ describe('TUI', function() command('call jobresize(b:terminal_job_id, 1, 4)') screen:try_resize(57, 17) command('call jobresize(b:terminal_job_id, 57, 17)') - assert_alive() + screen:expect([[ + {1:0}000;;Cc;0;BN;;;;;N;NULL;;;; | + 0001;;Cc;0;BN;;;;;N;START OF HEADING;;;; | + 0002;;Cc;0;BN;;;;;N;START OF TEXT;;;; | + 0003;;Cc;0;BN;;;;;N;END OF TEXT;;;; | + 0004;;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; | + 0005;;Cc;0;BN;;;;;N;ENQUIRY;;;; | + 0006;;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | + 0007;;Cc;0;BN;;;;;N;BELL;;;; | + 0008;;Cc;0;BN;;;;;N;BACKSPACE;;;; | + 0009;;Cc;0;S;;;;;N;CHARACTER TABULATION;;;; | + 000A;;Cc;0;B;;;;;N;LINE FEED (LF);;;; | + 000B;;Cc;0;S;;;;;N;LINE TABULATION;;;; | + 000C;;Cc;0;WS;;;;;N;FORM FEED (FF);;;; | + 000D;;Cc;0;B;;;;;N;CARRIAGE RETURN (CR);;;; | + {5:test/functional/fixtures/bigfile.txt }| + | + {3:-- TERMINAL --} | + ]]) end) it('accepts resize while pager is active', function() -- cgit