diff options
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() ] |