summaryrefslogtreecommitdiffstats
path: root/test/t/test_env.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-17 14:57:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-17 14:57:17 +0000
commit8c80e4dce14eed4e3c06b16fc307c6c7d20b9af8 (patch)
tree4477eaed15415ddadc3e88205234659628759415 /test/t/test_env.py
parentReleasing progress-linux version 1:2.13.0-1~progress7.99u1. (diff)
downloadbash-completion-8c80e4dce14eed4e3c06b16fc307c6c7d20b9af8.tar.xz
bash-completion-8c80e4dce14eed4e3c06b16fc307c6c7d20b9af8.zip
Merging upstream version 1:2.14.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/t/test_env.py')
-rw-r--r--test/t/test_env.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/t/test_env.py b/test/t/test_env.py
index 3d1a684..7608a4b 100644
--- a/test/t/test_env.py
+++ b/test/t/test_env.py
@@ -1,7 +1,44 @@
import pytest
+from conftest import assert_complete
+
class TestEnv:
@pytest.mark.complete("env --", require_longopt=True)
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("env __unknown_variable__=")
+ def test_unknown_variable_falls_back_to_filedir(self, completion):
+ assert "shared/" in completion
+
+ @pytest.mark.complete("env LANG=", xfail="! locale -a &>/dev/null")
+ def test_lang_envvar(self, completion):
+ assert any(x == "C" or x.startswith("C.") for x in completion)
+
+ @pytest.mark.parametrize(
+ "opts",
+ [
+ "",
+ "foo=bar",
+ "--debug",
+ "--debug foo=bar",
+ "-",
+ "- foo=bar",
+ ],
+ )
+ def test_command(self, bash, opts):
+ completion = assert_complete(bash, "env %s s" % opts)
+ assert completion == "h" or "sh" in completion
+
+ @pytest.mark.parametrize(
+ "opts",
+ [
+ "foo=bar --non-existent",
+ "- --non-existent",
+ "-- --non-existent",
+ ],
+ )
+ def test_option_like_command(self, bash, opts):
+ completion = assert_complete(bash, "env %s s" % opts)
+ assert not (completion == "h" or "sh" in completion)