diff options
Diffstat (limited to 'cliff/tests/test_formatters_shell.py')
-rw-r--r-- | cliff/tests/test_formatters_shell.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/cliff/tests/test_formatters_shell.py b/cliff/tests/test_formatters_shell.py index 93452ba..e6813e5 100644 --- a/cliff/tests/test_formatters_shell.py +++ b/cliff/tests/test_formatters_shell.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from six import StringIO +from six import StringIO, text_type from cliff.formatters import shell @@ -18,3 +18,17 @@ def test_shell_formatter(): sf.emit_one(c, d, output, args) actual = output.getvalue() assert expected == actual + + +def test_shell_formatter_with_non_string_values(): + sf = shell.ShellFormatter() + c = ('a', 'b', 'c', 'd', 'e') + d = (True, False, 100, '"esc"', text_type('"esc"')) + expected = 'a="True"\nb="False"\nc="100"\nd="\\"esc\\""\ne="\\"esc\\""\n' + output = StringIO() + args = mock.Mock() + args.variables = ['a', 'b', 'c', 'd', 'e'] + args.prefix = '' + sf.emit_one(c, d, output, args) + actual = output.getvalue() + assert expected == actual |