Fix winsize test to support unsigned short

The type of winsize.ws_col and winsize.ws_row is unsigned short, so
change python's struct.unpack format from 'hh' (short) to 'HH'.
Otherwise, we can only test sizes up to 32767 when actually sizes up to
65535 are supported.
This commit is contained in:
Leroy Hopson 2022-06-26 15:00:36 +07:00
parent bc73021064
commit 659bceed98
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA

View file

@ -54,6 +54,15 @@ func test_open_pty_has_correct_win_size():
assert_eq(winsize.rows, rows) assert_eq(winsize.rows, rows)
func test_win_size_supports_max_unsigned_short_value():
var cols = 65535
var rows = 65535
var result = pty.open(cols, rows)
var winsize = helper._get_winsize(result[1].master)
assert_eq(winsize.cols, cols)
assert_eq(winsize.cols, rows)
func test_closes_pty_on_exit(): func test_closes_pty_on_exit():
var num_pts = helper._get_pts().size() var num_pts = helper._get_pts().size()
pty.fork("sleep", ["1000"]) pty.fork("sleep", ["1000"])
@ -83,7 +92,7 @@ class Helper:
[ [
"-c", "-c",
( (
"import struct, fcntl, termios; print(struct.unpack('hh', fcntl.ioctl(%d, termios.TIOCGWINSZ, '1234')))" "import struct, fcntl, termios; print(struct.unpack('HH', fcntl.ioctl(%d, termios.TIOCGWINSZ, '1234')))"
% fd % fd
) )
], ],