Use different string for tmux-2.0

This commit is contained in:
Foo 2015-05-10 15:33:43 +03:00
parent a326153ba0
commit 424d71ee57

View File

@ -36,7 +36,7 @@ def test_expected_result(p, expected_result, cols, rows, print_logs):
last_line = [] last_line = []
for col in range(cols): for col in range(cols):
last_line.append(p[rows - 1, col]) last_line.append(p[rows - 1, col])
attempts = 10 attempts = 3
result = None result = None
while attempts: while attempts:
result = tuple(( result = tuple((
@ -176,6 +176,26 @@ def main(attempts=3):
) )
p.start() p.start()
sleep(2) sleep(2)
expected_result_2_0 = (
(((0, 0, 0), (243, 243, 243), 1, 0, 0), ' 0 '),
(((243, 243, 243), (11, 11, 11), 0, 0, 0), ' '),
(((255, 255, 255), (11, 11, 11), 0, 0, 0), ' S2 string here '),
(((133, 133, 133), (11, 11, 11), 0, 0, 0), ' 0 '),
(((88, 88, 88), (11, 11, 11), 0, 0, 0), '| '),
(((188, 188, 188), (11, 11, 11), 0, 0, 0), 'bash '),
(((255, 255, 255), (11, 11, 11), 0, 0, 0), ' '),
(((133, 133, 133), (11, 11, 11), 0, 0, 0), ' 1 '),
(((88, 88, 88), (11, 11, 11), 0, 0, 0), '| '),
(((0, 102, 153), (11, 11, 11), 0, 0, 0), 'bash '),
(((255, 255, 255), (11, 11, 11), 0, 0, 0), ' '),
(((11, 11, 11), (0, 102, 153), 0, 0, 0), ' '),
(((102, 204, 255), (0, 102, 153), 0, 0, 0), '2 | '),
(((255, 255, 255), (0, 102, 153), 1, 0, 0), 'bash '),
(((0, 102, 153), (11, 11, 11), 0, 0, 0), ' '),
(((255, 255, 255), (11, 11, 11), 0, 0, 0), ' ' * 128),
(((88, 88, 88), (11, 11, 11), 0, 0, 0), ' '),
(((199, 199, 199), (88, 88, 88), 0, 0, 0), ' S1 string here '),
)
expected_result_new = ( expected_result_new = (
(((0, 0, 0), (243, 243, 243), 1, 0, 0), ' 0 '), (((0, 0, 0), (243, 243, 243), 1, 0, 0), ' 0 '),
(((243, 243, 243), (11, 11, 11), 0, 0, 0), ' '), (((243, 243, 243), (11, 11, 11), 0, 0, 0), ' '),
@ -192,7 +212,7 @@ def main(attempts=3):
(((102, 204, 255), (0, 102, 153), 0, 0, 0), '2 | '), (((102, 204, 255), (0, 102, 153), 0, 0, 0), '2 | '),
(((255, 255, 255), (0, 102, 153), 1, 0, 0), 'bash '), (((255, 255, 255), (0, 102, 153), 1, 0, 0), 'bash '),
(((0, 102, 153), (11, 11, 11), 0, 0, 0), ' '), (((0, 102, 153), (11, 11, 11), 0, 0, 0), ' '),
(((255, 255, 255), (11, 11, 11), 0, 0, 0), ' '), (((255, 255, 255), (11, 11, 11), 0, 0, 0), ' ' * 127),
(((88, 88, 88), (11, 11, 11), 0, 0, 0), ' '), (((88, 88, 88), (11, 11, 11), 0, 0, 0), ' '),
(((199, 199, 199), (88, 88, 88), 0, 0, 0), ' S1 string here '), (((199, 199, 199), (88, 88, 88), 0, 0, 0), ' S1 string here '),
) )
@ -212,15 +232,17 @@ def main(attempts=3):
(((102, 204, 255), (0, 102, 153), 0, 0, 0), '2 | '), (((102, 204, 255), (0, 102, 153), 0, 0, 0), '2 | '),
(((255, 255, 255), (0, 102, 153), 1, 0, 0), 'bash '), (((255, 255, 255), (0, 102, 153), 1, 0, 0), 'bash '),
(((0, 102, 153), (11, 11, 11), 0, 0, 0), ' '), (((0, 102, 153), (11, 11, 11), 0, 0, 0), ' '),
(((255, 255, 255), (11, 11, 11), 0, 0, 0), ' '), (((255, 255, 255), (11, 11, 11), 0, 0, 0), ' ' * 127),
(((88, 88, 88), (11, 11, 11), 0, 0, 0), ' '), (((88, 88, 88), (11, 11, 11), 0, 0, 0), ' '),
(((199, 199, 199), (88, 88, 88), 0, 0, 0), ' S1 string here '), (((199, 199, 199), (88, 88, 88), 0, 0, 0), ' S1 string here '),
) )
tmux_version = get_tmux_version(get_fallback_logger()) tmux_version = get_tmux_version(get_fallback_logger())
if tmux_version < (1, 8): if tmux_version >= (2, 0):
expected_result = expected_result_old expected_result = expected_result_2_0
else: elif tmux_version >= (1, 8):
expected_result = expected_result_new expected_result = expected_result_new
else:
expected_result = expected_result_old
if not test_expected_result(p, expected_result, cols, rows, not attempts): if not test_expected_result(p, expected_result, cols, rows, not attempts):
if attempts: if attempts:
pass pass