summaryrefslogtreecommitdiffstats
path: root/tests/test_utils.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 10:22:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 10:22:56 +0000
commitdcf7f37a77e03d9c44f34fd2a5bd88eed6c09cad (patch)
tree759977c3a6a9a01b0d9c1bae0b81b7e0c1543a01 /tests/test_utils.py
parentAdding upstream version 0.1.45. (diff)
downloaddebputy-dcf7f37a77e03d9c44f34fd2a5bd88eed6c09cad.tar.xz
debputy-dcf7f37a77e03d9c44f34fd2a5bd88eed6c09cad.zip
Adding upstream version 0.1.46.upstream/0.1.46
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/test_utils.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py
new file mode 100644
index 0000000..e1dc87e
--- /dev/null
+++ b/tests/test_utils.py
@@ -0,0 +1,20 @@
+from typing import Sequence, Union
+
+import pytest
+
+from debputy.util import escape_shell
+
+
+@pytest.mark.parametrize(
+ "arg,expected",
+ [
+ ("foo bar", '"foo bar"'),
+ ("a'b", r"""a\'b"""),
+ ("foo=bar and baz", 'foo="bar and baz"'),
+ ("--foo=bar and baz", '--foo="bar and baz"'),
+ ("--foo with spaces=bar and baz", '"--foo with spaces=bar and baz"'),
+ ],
+)
+def test_symlink_normalization(arg: Union[str, Sequence[str]], expected: str) -> None:
+ actual = escape_shell(arg) if isinstance(arg, str) else escape_shell(*arg)
+ assert actual == expected