@@ -36,16 +36,55 @@ def test_7(self, completion):
3636 def test_8 (self , completion ):
3737 assert completion
3838
39+ @pytest .mark .complete ("export BASH_VERSIO" )
40+ def test_no_equals_sign_for_variable_incomplete (self , completion ):
41+ """When the variable name is completed, we should not
42+ immediately suffix the equal sign. The equal sign will be
43+ appended on a further TAB after the word becomes a complete
44+ variable name.
45+ """
46+ assert completion
47+ assert "=" not in "" .join (completion )
48+ assert not completion .endswith (" " )
49+
50+ @pytest .mark .complete ("export BASH" )
51+ def test_no_equals_sign_for_variable_ambiguous (self , completion ):
52+ """When the completion is not unique, we should not suffix the
53+ equal sign.
54+ """
55+ assert completion
56+ assert "=" not in "" .join (completion )
57+ assert not completion .endswith (" " )
58+
59+ @pytest .mark .complete ("export BASH_VERSION" )
60+ def test_no_equals_sign_for_variable_complete (self , completion ):
61+ """Only when the current word is already complete and matches
62+ unique completion, we should suffix the equal sign.
63+ """
64+ assert completion
65+ assert "=" in "" .join (completion )
66+
3967 @pytest .fixture (scope = "class" )
4068 def export_f_canary (self , request , bash ):
4169 assert_bash_exec (bash , "_comp__test_export_f_canary() { return; }" )
4270
4371 @pytest .mark .complete ("export -f _comp__test_export_f_canar" )
44- def test_no_equals_sign_for_function (self , completion , export_f_canary ):
72+ def test_no_equals_sign_for_function_incomplete (
73+ self , completion , export_f_canary
74+ ):
4575 assert completion
4676 assert "=" not in "" .join (completion )
4777 assert completion .endswith (" " )
4878
79+ @pytest .mark .complete ("export -f _comp__test_export_f_canary" )
80+ def test_no_equals_sign_for_function_complete (
81+ self , completion , export_f_canary
82+ ):
83+ """We can suffix a space to a function name because there is
84+ no possibility that the equal sign is suffixed to a function
85+ name."""
86+ assert completion .output == " "
87+
4988 @pytest .mark .complete ("export -f -" )
5089 def test_second_option (self , completion ):
5190 assert completion
0 commit comments