mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-10 10:04:21 +01:00
test parse_cmd
This commit is contained in:
parent
101f7e0fb1
commit
0b8a27e64e
21
tests/test_pirate.py
Executable file
21
tests/test_pirate.py
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import unittest
|
||||||
|
import pirate.pirate
|
||||||
|
|
||||||
|
|
||||||
|
class TestPirate(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_parse_cmd(self):
|
||||||
|
tests = [
|
||||||
|
[['abc', ''], ['abc']],
|
||||||
|
[['abc %s', 'url'], ['abc', 'url']],
|
||||||
|
[['abc "%s"', 'url'], ['abc', 'url']],
|
||||||
|
[["abc \'%s\'", 'url'], ['abc', 'url']],
|
||||||
|
[['abc bash -c "\'%s\'"', 'url'], ['abc', 'bash', '-c', "'url'"]],
|
||||||
|
[['abc %s %s', 'url'], ['abc', 'url', 'url']],
|
||||||
|
]
|
||||||
|
for test in tests:
|
||||||
|
self.assertEqual(pirate.pirate.parse_cmd(*test[0]), test[1])
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
Loading…
Reference in New Issue
Block a user