From faef4585b28becc42d4b8017d57d8c5014de837b Mon Sep 17 00:00:00 2001
From: ZyX <kp-pav@yandex.ru>
Date: Fri, 16 Jan 2015 22:44:34 +0300
Subject: [PATCH] Add support for old tmux versions in tests

Tmux-1.6 does not have special highlighting for previously active window. Other
then that view is identical.
---
 tests/test_in_vterm/test_tmux.py | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/tests/test_in_vterm/test_tmux.py b/tests/test_in_vterm/test_tmux.py
index 042b7144..b8d585f7 100755
--- a/tests/test_in_vterm/test_tmux.py
+++ b/tests/test_in_vterm/test_tmux.py
@@ -10,6 +10,8 @@ from itertools import groupby
 from difflib import ndiff
 
 from powerline.lib.unicode import u
+from powerline.bindings.tmux import get_tmux_version
+from powerline import get_fallback_logger
 
 from tests.lib.terminal import ExpectProcess
 
@@ -79,7 +81,7 @@ def main():
 			(key, ''.join((i.text for i in subline)))
 			for key, subline in groupby(last_line, lambda i: i.cell_properties_key)
 		))
-		expected_result = (
+		expected_result_new = (
 			(((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  '),
@@ -99,6 +101,26 @@ def main():
 			(((88, 88, 88), (11, 11, 11), 0, 0, 0), ' '),
 			(((199, 199, 199), (88, 88, 88), 0, 0, 0), ' S1 string here '),
 		)
+		expected_result_old = (
+			(((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), '| '),
+			(((188, 188, 188), (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), '                                                                                                                               '),
+			(((88, 88, 88), (11, 11, 11), 0, 0, 0), ' '),
+			(((199, 199, 199), (88, 88, 88), 0, 0, 0), ' S1 string here '),
+		)
 		print('Result:')
 		shesc_result = ''.join((
 			'{0}{1}\x1b[m'.format(cell_properties_key_to_shell_escape(key), text)
@@ -106,6 +128,11 @@ def main():
 		))
 		print(shesc_result)
 		print('Expected:')
+		tmux_version = get_tmux_version(get_fallback_logger())
+		if tmux_version < (1, 8):
+			expected_result = expected_result_old
+		else:
+			expected_result = expected_result_new
 		shesc_expected_result = ''.join((
 			'{0}{1}\x1b[m'.format(cell_properties_key_to_shell_escape(key), text)
 			for key, text in expected_result