tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_escape_command_line.py (676B)


      1 #!/usr/bin/env python
      2 
      3 import mozunit
      4 
      5 
      6 def test_escape_command_line(mock_adb_object, redirect_stdout_and_assert):
      7    """Test _escape_command_line."""
      8    cases = {
      9        # expected output : test input
     10        "adb shell ls -l": ["adb", "shell", "ls", "-l"],
     11        "adb shell 'ls -l'": ["adb", "shell", "ls -l"],
     12        "-e 'if (true)'": ["-e", "if (true)"],
     13        "-e 'if (x === \"hello\")'": ["-e", 'if (x === "hello")'],
     14        "-e 'if (x === '\"'\"'hello'\"'\"')'": ["-e", "if (x === 'hello')"],
     15    }
     16    for expected, input in cases.items():
     17        assert mock_adb_object._escape_command_line(input) == expected
     18 
     19 
     20 if __name__ == "__main__":
     21    mozunit.main()