mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00

* Added env variable to ignore ./ and ../ in filepath completion * Changed ignore_dots to complete dots as always, never, or upon matching * Updated news * Added default 'matching' * Update ignore_dots.rst * black * fix test * tests Co-authored-by: Bailey Morgan <bailey.mccarty.morgan@gmail.com> Co-authored-by: a <a@a.a>
43 lines
1 KiB
Python
43 lines
1 KiB
Python
import pytest
|
|
|
|
from tests.tools import ON_WINDOWS
|
|
from xonsh.completers.base import complete_base
|
|
from xonsh.parsers.completion_context import (
|
|
CompletionContext,
|
|
CommandContext,
|
|
CommandArg,
|
|
PythonContext,
|
|
)
|
|
|
|
|
|
CUR_DIR = "." if ON_WINDOWS else "./" # for some reason this is what happens in `complete_path`
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def setup(xonsh_builtins, xonsh_execer, monkeypatch):
|
|
monkeypatch.setattr(xonsh_builtins.__xonsh__, "commands_cache", ["cool"])
|
|
|
|
|
|
def test_empty_line():
|
|
completions = complete_base(
|
|
CompletionContext(
|
|
command=CommandContext((), 0),
|
|
python=PythonContext("", 0)
|
|
)
|
|
)
|
|
assert completions
|
|
for exp in ["cool", "abs"]:
|
|
assert exp in completions
|
|
|
|
|
|
def test_empty_subexpr():
|
|
completions = complete_base(
|
|
CompletionContext(
|
|
command=CommandContext((), 0, subcmd_opening="$("),
|
|
python=None
|
|
)
|
|
)
|
|
assert completions
|
|
for exp in ["cool"]:
|
|
assert exp in completions
|
|
assert "abs" not in completions
|