diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2017-11-04 01:15:34 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2017-11-04 01:21:06 +0100 |
| commit | 534d54ef1ea8a606987dae15bc3a4585833b301b (patch) | |
| tree | 48fb505f13ccaa4609f95b6ef14dfa242f60cc4a | |
| parent | 2c04862d0a2c05430df878b8fddbe01df139b37a (diff) | |
Don't put 0 in .assignable for y-mode choice syms
Just return (2,). More intuitive, and makes y-mode choices just work in
the menuconfig example.
Turns out to be simple to implement with choice symbol visibility
depending on the Choice.
| -rw-r--r-- | kconfiglib.py | 3 | ||||
| -rw-r--r-- | testsuite.py | 36 |
2 files changed, 19 insertions, 20 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 1d0c2d0..d8f070b 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2720,6 +2720,9 @@ class Symbol(object): rev_dep_val = expr_value(self.rev_dep) if vis == 2: + if self.choice: + return (2,) + if not rev_dep_val: if self.type == BOOL or expr_value(self.weak_rev_dep) == 2: return (0, 2) diff --git a/testsuite.py b/testsuite.py index 0652316..de1967b 100644 --- a/testsuite.py +++ b/testsuite.py @@ -878,17 +878,13 @@ g "was {}." .format(item.name, module_msg, assignable, item.assignable)) - # Verify that the values can actually be assigned too, except for - # choice symbols in choices in y mode, where setting the user value - # on the choice symbol to n doesn't affect the selection - - if not (isinstance(item, Symbol) and item.choice is not None and - item.choice.tri_value == 2): - for val in item.assignable: - item.set_value(val) - verify(item.tri_value == val, - "Unable to set {} to {} {}, even though it was in " - ".assignable".format(item.name, val, module_msg)) + # Verify that the values can actually be assigned too + + for val in item.assignable: + item.set_value(val) + verify(item.tri_value == val, + "Unable to set {} to {} {}, even though it was in " + ".assignable".format(item.name, val, module_msg)) def verify_assignable(sym_name, assignable_no_modules, assignable_modules): verify_assignable_imp(c.syms[sym_name], @@ -951,22 +947,22 @@ g verify_assignable("M_IMP_N_VIS_TRI", ( ), ( )) # Symbols in y-mode choice - verify_assignable("Y_CHOICE_BOOL", (0, 2), (0, 2)) - verify_assignable("Y_CHOICE_TRISTATE", (0, 2), (0, 2)) - verify_assignable("Y_CHOICE_N_VIS_TRISTATE", ( ), ( )) + verify_assignable("Y_CHOICE_BOOL", (2,), (2,)) + verify_assignable("Y_CHOICE_TRISTATE", (2,), (2,)) + verify_assignable("Y_CHOICE_N_VIS_TRISTATE", ( ), ( )) # Symbols in m/y-mode choice, starting out in m mode, or y mode when # running without modules - verify_assignable("MY_CHOICE_BOOL", (0, 2), ( )) - verify_assignable("MY_CHOICE_TRISTATE", (0, 2), (0, 1)) - verify_assignable("MY_CHOICE_N_VIS_TRISTATE", ( ), ( )) + verify_assignable("MY_CHOICE_BOOL", (2,), ( )) + verify_assignable("MY_CHOICE_TRISTATE", (2,), (0, 1)) + verify_assignable("MY_CHOICE_N_VIS_TRISTATE", ( ), ( )) c.named_choices["MY_CHOICE"].set_value(2) # Symbols in m/y-mode choice, now in y mode - verify_assignable("MY_CHOICE_BOOL", (0, 2), (0, 2)) - verify_assignable("MY_CHOICE_TRISTATE", (0, 2), (0, 2)) - verify_assignable("MY_CHOICE_N_VIS_TRISTATE", ( ), ( )) + verify_assignable("MY_CHOICE_BOOL", (2,), (2,)) + verify_assignable("MY_CHOICE_TRISTATE", (2,), (2,)) + verify_assignable("MY_CHOICE_N_VIS_TRISTATE", ( ), ( )) def verify_choice_assignable(choice_name, assignable_no_modules, assignable_modules): |
