summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2012-12-15 15:23:48 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2012-12-15 15:23:48 +0100
commit2fb80bbd856280ab306c6087cdb9a4b077abacac (patch)
tree26083c32650e040bdd1e9a81d3f6711ebc080083
parentd5e9ebb3d06c3e3083fdc35e459a6a6226c237e1 (diff)
Verify types for choices without explicit types.
-rw-r--r--tests/Kchoice20
-rw-r--r--testsuite.py13
2 files changed, 32 insertions, 1 deletions
diff --git a/tests/Kchoice b/tests/Kchoice
index ce103ae..1915b1d 100644
--- a/tests/Kchoice
+++ b/tests/Kchoice
@@ -74,3 +74,23 @@ config OPT_3
config OPT_4
tristate "OPT_4"
endchoice
+
+# Choices without an explicitly specified type should get the type of the first
+# symbol with a type
+
+choice NO_TYPE_BOOL
+ prompt "no type bool"
+config NTB_1
+ bool "NTB_1"
+config NTB_2
+ tristate "NTB_2"
+endchoice
+
+choice NO_TYPE_TRISTATE
+ prompt "no type tristate"
+config NTT_1
+config NTT_2
+ tristate "NTB_2"
+config NTT_3
+ bool "NTT_3"
+endchoice
diff --git a/testsuite.py b/testsuite.py
index a8c0e0d..d0d2214 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -1214,7 +1214,8 @@ def run_selftests():
c = kconfiglib.Config("Kconfiglib/tests/Kchoice")
choice_bool, choice_bool_opt, choice_tristate, choice_tristate_opt, \
- choice_bool_m, choice_tristate_m, choice_defaults = c.get_choices()
+ choice_bool_m, choice_tristate_m, choice_defaults, \
+ choice_no_type_bool, choice_no_type_tristate = c.get_choices()
for choice in (choice_bool, choice_bool_opt, choice_bool_m,
choice_defaults):
@@ -1303,9 +1304,19 @@ def run_selftests():
for sym_name in ("TM_1", "TM_2"):
assign_and_verify_new_value(sym_name, "m", "m")
+ assign_and_verify_new_value(sym_name, "n", "n")
# "y" should be truncated
assign_and_verify_new_value(sym_name, "y", "m")
+ # Verify that choices with no explicitly specified type get the type of the
+ # first contained symbol with a type
+
+ verify(choice_no_type_bool.get_type() == kconfiglib.BOOL,
+ "Expected first choice without explicit type to have type bool")
+ verify(choice_no_type_tristate.get_type() == kconfiglib.TRISTATE,
+ "Expected second choice without explicit type to have type "
+ "tristate")
+
#
# Object dependencies
#