summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kconfiglib.py2
-rw-r--r--tests/Kassignable26
-rw-r--r--testsuite.py17
3 files changed, 41 insertions, 4 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 612fc58..ae86b2a 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -3190,7 +3190,7 @@ class Choice(object):
if vis == 2:
if not self.is_optional:
return (2,) if self.type == BOOL else (1, 2)
- return (2,)
+ return (0, 2) if self.type == BOOL else (0, 1, 2)
# vis == 1
diff --git a/tests/Kassignable b/tests/Kassignable
index fe88abe..f134a74 100644
--- a/tests/Kassignable
+++ b/tests/Kassignable
@@ -201,3 +201,29 @@ config MY_CHOICE_N_VIS_TRISTATE
tristate "m/y-mode choice tristate invisible" if n
endchoice
+
+
+# Choices with some other possible modes
+
+choice NMY_CHOICE
+ tristate "n/m/y-mode choice"
+ optional
+endchoice
+
+choice NY_CHOICE
+ bool "n/y-mode choice"
+ optional
+endchoice
+
+choice NM_CHOICE
+ tristate "n/m-mode choice" if m
+ optional
+endchoice
+
+choice M_CHOICE
+ tristate "m-mode choice" if m
+endchoice
+
+choice N_CHOICE
+ tristate "n-mode choice" if n
+endchoice
diff --git a/testsuite.py b/testsuite.py
index dd0fe7c..3abcbb0 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -879,12 +879,12 @@ g
def verify_assignable(sym_name, assignable, test_assign=True):
verify_assignable_imp(c.syms[sym_name], assignable, test_assign)
- def verify_const_unassignable(sym_name):
- verify_assignable_imp(c.const_syms[sym_name], (), False)
-
# Test with modules enabled first
c.modules.set_value(2)
+ def verify_const_unassignable(sym_name):
+ verify_assignable_imp(c.const_syms[sym_name], (), False)
+
# Things that shouldn't be .assignable
verify_const_unassignable("n")
verify_const_unassignable("m")
@@ -954,6 +954,17 @@ g
verify_assignable("MY_CHOICE_TRISTATE", (0, 2), test_assign=False)
verify_assignable("MY_CHOICE_N_VIS_TRISTATE", ( ))
+ def verify_choice_assignable(choice_name, assignable):
+ verify_assignable_imp(c.named_choices[choice_name], assignable, True)
+
+ verify_choice_assignable("Y_CHOICE", ( 2,))
+ verify_choice_assignable("MY_CHOICE", ( 1, 2 ))
+ verify_choice_assignable("NMY_CHOICE", (0, 1, 2 ))
+ verify_choice_assignable("NY_CHOICE", (0, 2 ))
+ verify_choice_assignable("NM_CHOICE", (0, 1 ))
+ verify_choice_assignable("M_CHOICE", ( 1, ))
+ verify_choice_assignable("N_CHOICE", ( ))
+
print("Testing object relations")