mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00

* completers: Move `apply_lprefix` to completers/tools.py * completers: Implement non-exclusive completers * completers: Make end_proc keywords and tokens non-exclusive * completers: Implement environment vars non-exclusive completer * news: Add non-exclusive-completers
21 lines
563 B
Python
21 lines
563 B
Python
import pytest
|
|
|
|
from xonsh.parsers.completion_context import CompletionContextParser
|
|
from xonsh.completers.environment import complete_environment_vars
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def parser():
|
|
return CompletionContextParser()
|
|
|
|
|
|
@pytest.mark.parametrize("cmd", (
|
|
"ls $WO",
|
|
"ls /home/$WO",
|
|
"ls @('hi ' + $WO",
|
|
))
|
|
def test_simple(cmd, xonsh_builtins, monkeypatch, parser):
|
|
monkeypatch.setitem(xonsh_builtins.__xonsh__.env, "WOW", 1)
|
|
|
|
context = parser.parse(cmd, len(cmd))
|
|
assert complete_environment_vars(context) == ({"$WOW"}, 3)
|