diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-01-27 10:29:37 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-01-27 10:29:37 +1300 |
commit | 460107589c2ef425ef124c74908be1fa86ebab9d (patch) | |
tree | 75d97a6be79760524b735a4fdfea2678f560dc28 /test | |
parent | bd6c0499fb121306c7e3095ce38ddc3f5718d808 (diff) | |
download | mitmproxy-460107589c2ef425ef124c74908be1fa86ebab9d.tar.gz mitmproxy-460107589c2ef425ef124c74908be1fa86ebab9d.tar.bz2 mitmproxy-460107589c2ef425ef124c74908be1fa86ebab9d.zip |
Add tab completion for save and load path specs.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_console.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/test/test_console.py b/test/test_console.py index c5c856f8..cfafed96 100644 --- a/test/test_console.py +++ b/test/test_console.py @@ -288,9 +288,39 @@ class uformat_keyvals(libpry.AutoTree): ] ) +class uPathCompleter(libpry.AutoTree): + def test_completion(self): + c = console._PathCompleter(True) + c.reset() + c.lookup = [ + ("a", "x/a"), + ("aa", "x/aa"), + ] + assert c.complete("a") == "a" + assert c.final == "x/a" + assert c.complete("a") == "aa" + assert c.complete("a") == "a" + + c = console._PathCompleter(True) + r = c.complete("l") + assert c.final.endswith(r) + + c.reset() + assert c.complete("/nonexistent") == "/nonexistent" + assert c.final == "/nonexistent" + c.reset() + assert c.complete("~") != "~" + + c.reset() + s = "thisisatotallynonexistantpathforsure" + assert c.complete(s) == s + assert c.final == s + + tests = [ uFlow(), uformat_keyvals(), - uState() + uState(), + uPathCompleter() ] |