diff --git a/bin/autojump b/bin/autojump index bfdcbf2..a2b4be6 100755 --- a/bin/autojump +++ b/bin/autojump @@ -354,13 +354,6 @@ def unico(text): else: return text -def output_quotes(config, text): - quotes = "" - if config['args'].complete and config['args'].bash: - quotes = "'" - - output("%s%s%s" % (quotes, text, quotes)) - def output(text, encoding=None): """ Wrapper for the print function, using the filesystem encoding by default @@ -373,6 +366,14 @@ def output(text, encoding=None): else: print(text) +def output_quotes(config, text): + quotes = "" + if config['args'].complete and config['args'].bash: + quotes = "'" + + result = "%s%s%s" % (quotes, text, quotes) + output(result) + return result # # Main Logic diff --git a/tests/autojump_test.py b/tests/autojump_test.py index 0a577d2..bdcf536 100644 --- a/tests/autojump_test.py +++ b/tests/autojump_test.py @@ -67,17 +67,15 @@ class TestUtilities(unittest.TestCase): self.assertEqual(decode('banana man'), u'banana man') def test_output_quotes(self): - output = lambda x: x - from pprint import pprint as pp; import ipdb; ipdb.set_trace() - pp(self.config) - self.config['args'].complete = False - self.config['args'].bash = False + args = mock.Mock() + args.bash = True + args.complete = True + config = {'args': args} + normal = "foo" quotes = "'foo'" - self.assertEqual( - test_output_quotes(config, normal), - normal) + self.assertEqual(output_quotes(config, normal), quotes) if __name__ == "__main__":