sway-config-fedora/tests/test helper
Aleksei Bavshin 2fb8e284af
sway: escape commands from launcher before sending to IPC
`swaymsg exec` does not preserve quoting or field splitting of the
arguments. Additional escaping is necessary to be able to pass fields
with special characters, such as spaces or quotes.
2023-03-30 20:53:59 -07:00

24 lines
501 B
Python
Executable file

#!/usr/bin/python3
import sys
TEST = [
"--lor'em",
'ipsum $dolor sit" amet;',
"consectetur\tadipiscing\\' elit,",
"(sed do eiusmod tempor) [incididunt ut labore]",
"et dolore magna[ aliqua.",
]
status = "passed"
if len(sys.argv) != len(TEST) + 1:
status = "failed"
for left, right in zip(sys.argv[1:], TEST):
if left != right:
print(f"'{left}' != '{right}'")
status = "failed"
print(f"Test status: {status}")
sys.exit(0 if status == "passed" else 1)