diff options
author | Pedro Worcel <pedro@worcel.com> | 2014-02-22 17:15:37 +1300 |
---|---|---|
committer | Pedro Worcel <pedro@worcel.com> | 2014-02-22 17:15:37 +1300 |
commit | 3e500344282a364f1fbd7245c49d980fe0bfab11 (patch) | |
tree | a6c0acad04addf8509c0d1efd9b7aa3fd8edb688 /test/test_console_search.py | |
parent | 9fe6b8fd268c95fc1a93148c6e2f4cd4d8a5bb05 (diff) | |
download | mitmproxy-3e500344282a364f1fbd7245c49d980fe0bfab11.tar.gz mitmproxy-3e500344282a364f1fbd7245c49d980fe0bfab11.tar.bz2 mitmproxy-3e500344282a364f1fbd7245c49d980fe0bfab11.zip |
fix the wrapping on backward searches
Diffstat (limited to 'test/test_console_search.py')
-rw-r--r-- | test/test_console_search.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/test_console_search.py b/test/test_console_search.py index 60b998cc..0e47ef79 100644 --- a/test/test_console_search.py +++ b/test/test_console_search.py @@ -153,6 +153,24 @@ def test_search_back_multi_multi_line(): # first line now f.search_again(backwards=True) text_object = tutils.get_body_line(f.last_displayed_body, 0) - print(text_object.get_text(), ('this is string', [(None, 8), (f.highlight_color, 6)])) + assert text_object.get_text() == ('this is string', [(None, 8), (f.highlight_color, 6)]) + +def test_search_backwards_wraps(): + """ + when searching past line 0, it should loop. + """ + f = tutils.tflowview(request_contents="this is string\nthis is string\nthis is string") + + # should be on second line + f.search("string") + f.search_again() + text_object = tutils.get_body_line(f.last_displayed_body, 1) + assert text_object.get_text() == ('this is string', [(None, 8), (f.highlight_color, 6)]) + + # should be on third now. + f.search_again(backwards=True) + message = f.search_again(backwards=True) + + text_object = tutils.get_body_line(f.last_displayed_body, 2) assert text_object.get_text() == ('this is string', [(None, 8), (f.highlight_color, 6)]) |