From 802791e979fb1fee6483f7c61d4c57b30ada1f0f Mon Sep 17 00:00:00 2001 From: XZS Date: Wed, 27 Apr 2016 12:30:26 +0200 Subject: [PATCH] test stash segment --- tests/test_segments.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_segments.py b/tests/test_segments.py index 0a7adcbf..207c2843 100644 --- a/tests/test_segments.py +++ b/tests/test_segments.py @@ -738,6 +738,29 @@ class TestVcs(TestCommon): 'divider_highlight_group': None }]) + def test_stash(self): + pl = Pl() + create_watcher = get_fallback_create_watcher() + stash = partial(self.module.stash, pl=pl, create_watcher=create_watcher, segment_info={'getcwd': os.getcwd}) + + def forge_stash(n): + return replace_attr(self.module, 'guess', get_dummy_guess(stash=lambda: n, directory='/tmp/tests')) + + with forge_stash(0): + self.assertEqual(stash(), None) + with forge_stash(1): + self.assertEqual(stash(), [{ + 'highlight_groups': ['stash'], + 'contents': '1', + 'divider_highlight_group': None + }]) + with forge_stash(2): + self.assertEqual(stash(), [{ + 'highlight_groups': ['stash'], + 'contents': '2', + 'divider_highlight_group': None + }]) + class TestTime(TestCommon): module_name = 'time'