summaryrefslogtreecommitdiff
path: root/test/t/test_ssh.py
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-08-03 18:43:13 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-08-03 18:43:13 -0300
commit95623d39d6029ba78ec96ad5ea08e9ac12629b91 (patch)
treeea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /test/t/test_ssh.py
parent019f3cc463db63abc6460f97deb488deec43840b (diff)
downloadbash-completion-upstream.tar.gz
New upstream version 2.11upstream/2.11upstream
Diffstat (limited to 'test/t/test_ssh.py')
-rw-r--r--test/t/test_ssh.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/t/test_ssh.py b/test/t/test_ssh.py
index 204b7c7c..8e958195 100644
--- a/test/t/test_ssh.py
+++ b/test/t/test_ssh.py
@@ -1,10 +1,12 @@
import pytest
+from conftest import assert_complete, partialize
+
class TestSsh:
@pytest.mark.complete("ssh -Fsp", cwd="ssh")
def test_1(self, completion):
- assert completion == "-Fspaced conf"
+ assert completion == r"aced\ \ conf"
@pytest.mark.complete("ssh -F config ls", cwd="ssh")
def test_2(self, completion):
@@ -32,3 +34,27 @@ class TestSsh:
@pytest.mark.complete("ssh -", require_cmd=True)
def test_6(self, completion):
assert completion
+
+ @pytest.mark.complete("ssh -F")
+ def test_capital_f_without_space(self, completion):
+ assert completion
+ assert not any(
+ "option requires an argument -- F" in x for x in completion
+ )
+
+ @pytest.mark.complete("ssh -F nonexistent ")
+ def test_capital_f_nonexistent(self, completion):
+ assert completion
+
+ def test_partial_hostname(self, bash, known_hosts):
+ first_char, partial_hosts = partialize(bash, known_hosts)
+ completion = assert_complete(bash, "ssh %s" % first_char)
+ if len(completion) == 1:
+ assert completion == partial_hosts[0][1:]
+ else:
+ assert completion == sorted(x for x in partial_hosts)
+
+ @pytest.mark.parametrize("protocol", "4 6 9".split())
+ def test_protocol_option_bundling(self, bash, protocol):
+ completion = assert_complete(bash, "ssh -%sF ssh/" % protocol)
+ assert "config" in completion