|
1 | 1 | import os
|
| 2 | +import sys |
2 | 3 | from itertools import chain
|
3 | 4 |
|
4 | 5 | import pytest
|
@@ -158,6 +159,28 @@ def test_xfunc_remote_files(self, bash):
|
158 | 159 | "shared/default/foo.d/",
|
159 | 160 | ]
|
160 | 161 |
|
| 162 | + @pytest.fixture |
| 163 | + def tmpdir_backslash(self, request, bash): |
| 164 | + if sys.platform.startswith("win"): |
| 165 | + pytest.skip("Filenames not allowed on Windows") |
| 166 | + |
| 167 | + tmpdir, _, _ = prepare_fixture_dir( |
| 168 | + request, files=["local_path-file\\"], dirs=[] |
| 169 | + ) |
| 170 | + return tmpdir |
| 171 | + |
| 172 | + def test_local_path_ending_with_backslash(self, bash, tmpdir_backslash): |
| 173 | + completion = assert_complete( |
| 174 | + bash, "scp local_path-", cwd=tmpdir_backslash |
| 175 | + ) |
| 176 | + assert completion.output == r"file\\ " |
| 177 | + |
| 178 | + def test_remote_path_ending_with_backslash(self, bash): |
| 179 | + assert_bash_exec(bash, "ssh() { echo 'hypothetical\\'; }") |
| 180 | + completion = assert_complete(bash, "scp remote_host:hypo") |
| 181 | + assert_bash_exec(bash, "unset -f ssh") |
| 182 | + assert completion.output == r"thetical\\\\ " |
| 183 | + |
161 | 184 | @pytest.fixture
|
162 | 185 | def tmpdir_mkfifo(self, request, bash):
|
163 | 186 | tmpdir, _, _ = prepare_fixture_dir(request, files=[], dirs=[])
|
|
0 commit comments