mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1499511 - Add unit test for adb.py _escape_command_line; r=bc
This commit is contained in:
parent
072194ea2a
commit
98f7372cce
@ -4,3 +4,4 @@ skip-if = python == 3
|
||||
[test_socket_connection.py]
|
||||
[test_is_app_installed.py]
|
||||
[test_chown.py]
|
||||
[test_escape_command_line.py]
|
||||
|
23
testing/mozbase/mozdevice/tests/test_escape_command_line.py
Normal file
23
testing/mozbase/mozdevice/tests/test_escape_command_line.py
Normal file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import mozunit
|
||||
|
||||
|
||||
def test_escape_command_line(mock_adb_object, redirect_stdout_and_assert):
|
||||
"""Test _escape_command_line."""
|
||||
cases = {
|
||||
# expected output : test input
|
||||
'adb shell ls -l': ['adb', 'shell', 'ls', '-l'],
|
||||
'adb shell "ls -l"': ['adb', 'shell', 'ls -l'],
|
||||
'-e "if (true)"': ['-e', 'if (true)'],
|
||||
'-e "if (x === \\"hello\\")"': ['-e', 'if (x === "hello")'],
|
||||
'-e "if (x === \'hello\')"': ['-e', "if (x === 'hello')"],
|
||||
}
|
||||
for expected, input in cases.items():
|
||||
assert mock_adb_object._escape_command_line(input) == expected
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mozunit.main()
|
Loading…
Reference in New Issue
Block a user