`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.
24 lines
501 B
Python
Executable file
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)
|