| 1 | # Copyright (C) 2020 Sebastian Pipping <[email protected]> |
| 2 | # Licensed under GPL v3 or later |
| 3 | |
| 4 | from unittest import TestCase |
| 5 | |
| 6 | from parameterized import parameterized |
| 7 | |
| 8 | from .._shell import escape_for_shell_display |
| 9 | |
| 10 | |
| 11 | class ShellEscapingTest(TestCase): |
| 12 | @parameterized.expand( |
| 13 | [ |
| 14 | ("", "''"), |
| 15 | ("one", "one"), |
| 16 | ("one two", "'one two'"), |
| 17 | ("tick'tick'$", "\"tick'tick'\\$\""), |
| 18 | ] |
| 19 | ) |
| 20 | def test(self, text, expected_escaped_text): |
| 21 | self.assertEqual(escape_for_shell_display(text), expected_escaped_text) |