Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Empty file.
23 changes: 19 additions & 4 deletions test/t/test_scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_basic(self, hosts, completion):
)
),
# Local filenames
["config", "known_hosts", "local_path/", r"spaced\ \ conf"],
["config", "known_hosts", r"spaced\ \ conf"],
)
)
assert completion == expected
Expand All @@ -53,7 +53,7 @@ def test_basic_spaced_conf(self, hosts, completion):
)
),
# Local filenames
["config", "known_hosts", "local_path/", r"spaced\ \ conf"],
["config", "known_hosts", r"spaced\ \ conf"],
)
)
assert completion == expected
Expand Down Expand Up @@ -247,8 +247,23 @@ def test_local_path_with_spaces_1(self, completion):
def test_local_path_with_spaces_2(self, completion):
assert completion == r"\ conf"

@pytest.mark.complete("scp backslash-a\\", cwd="scp/local_path")
def test_local_path_backslash(self, completion):
@pytest.fixture
def tmpdir_backslash_2(self, request, bash):
if sys.platform.startswith("win"):
pytest.skip("Filenames not allowed on Windows")

tmpdir = prepare_fixture_dir(
request,
files=["backslash-a b.txt", r"backslash-a\ b.txt"],
dirs=[],
)
return tmpdir

@pytest.mark.complete
def test_local_path_backslash(self, bash, tmpdir_backslash_2):
completion = assert_complete(
bash, "scp backslash-a\\", cwd=tmpdir_backslash_2
)
assert completion == sorted(
[r"backslash-a\ b.txt", r"backslash-a\\\ b.txt"]
)