File: test_shell.py

package info (click to toggle)
git-delete-merged-branches 7.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: python: 1,843; sh: 26; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 574 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright (C) 2020 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later

from unittest import TestCase

from parameterized import parameterized

from .._shell import escape_for_shell_display


class ShellEscapingTest(TestCase):
    @parameterized.expand(
        [
            ("", "''"),
            ("one", "one"),
            ("one two", "'one two'"),
            ("tick'tick'$", "\"tick'tick'\\$\""),
        ]
    )
    def test(self, text, expected_escaped_text):
        self.assertEqual(escape_for_shell_display(text), expected_escaped_text)