summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-05-14 14:48:22 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-05-16 19:58:22 +0200
commit63a44186137e2706afec0aef278cd5d123fc98dc (patch)
treeeeac59fe4c3af336fbb88c5ff13eda4420d166fd /tests
parentcbf32e29a130d22bc734b7778e6304ac9df2a3e8 (diff)
Record which MenuNode has each property
This allows accurate documentation to be generated for symbols and choices defined in multiple locations. There are now MenuNode.defaults, MenuNode.selects, etc., lists that mirror the corresponding Symbol/Choice lists. Symbol/Choice.__str__() now correctly show property locations as well, by simply concatenating the strings returned by MenuNode.__str__() for each node. _parse_properties() was modified to add all properties directly to the menu node instead of adding them to the contained symbol or choice. The properties are then copied up to symbols and choices in _finalize_tree(). Dependency propagation is handled at the same time. As a side effect, this cleans up the code a bit and de-bloats _parse_properties(). Update the menuconfig implementation to use the new functionality. It now lists the menu nodes for symbols and choices with the correct properties for each node (previously, all defaults, selects, implies, and ranges appeared on the first definition).
Diffstat (limited to 'tests')
-rw-r--r--tests/Kdirdep30
-rw-r--r--tests/Kstr100
2 files changed, 130 insertions, 0 deletions
diff --git a/tests/Kdirdep b/tests/Kdirdep
new file mode 100644
index 0000000..cbb88b9
--- /dev/null
+++ b/tests/Kdirdep
@@ -0,0 +1,30 @@
+config NO_DEP_SYM
+ bool
+
+config DEP_SYM
+ bool
+ depends on A
+
+config DEP_SYM
+ depends on B && C
+
+config DEP_SYM
+ depends on !D
+
+
+choice NO_DEP_CHOICE
+ bool "no dep. choice"
+endchoice
+
+choice DEP_CHOICE
+ bool "dep. choice"
+ depends on A
+endchoice
+
+choice DEP_CHOICE
+ depends on B
+endchoice
+
+choice DEP_CHOICE
+ depends on C
+endchoice
diff --git a/tests/Kstr b/tests/Kstr
index 547da9c..e3f4746 100644
--- a/tests/Kstr
+++ b/tests/Kstr
@@ -74,6 +74,58 @@ config OPTIONS
option defconfig_list
option env="ENV"
+if LOC_1
+config CORRECT_PROP_LOCS_BOOL
+ prompt "prompt 1"
+ default DEFAULT_1
+ default DEFAULT_2
+ select SELECT_1
+ select SELECT_2
+ imply IMPLY_1
+ imply IMPLY_2
+ help
+ help 1
+endif
+
+if LOC_2
+menuconfig CORRECT_PROP_LOCS_BOOL
+ bool "prompt 2"
+ default DEFAULT_3
+ default DEFAULT_4
+ select SELECT_3
+ select SELECT_4
+ imply IMPLY_3
+ imply IMPLY_4
+ help
+ help 2
+endif
+
+if LOC_3
+config CORRECT_PROP_LOCS_BOOL
+ prompt "prompt 3"
+ default DEFAULT_5
+ default DEFAULT_6
+ select SELECT_5
+ select SELECT_6
+ imply IMPLY_5
+ imply IMPLY_6
+ help
+ help 2
+endif
+
+if LOC_1
+config CORRECT_PROP_LOCS_INT
+ int
+ range 1 2
+ range 3 4
+endif
+
+if LOC_2
+config CORRECT_PROP_LOCS_INT
+ range 5 6
+ range 7 8
+endif
+
choice CHOICE
tristate "foo"
default CHOICE_1
@@ -91,3 +143,51 @@ choice
tristate "no name"
optional
endchoice
+
+if LOC_1
+choice CORRECT_PROP_LOCS_CHOICE
+ bool
+ default CHOICE_3
+
+config CHOICE_3
+ bool "choice 3"
+
+config CHOICE_4
+ bool "choice 3"
+
+config CHOICE_5
+ bool "choice 3"
+
+endchoice
+endif
+
+if LOC_2
+choice CORRECT_PROP_LOCS_CHOICE
+ default CHOICE_4
+endchoice
+endif
+
+if LOC_3
+choice CORRECT_PROP_LOCS_CHOICE
+ default CHOICE_5
+endchoice
+endif
+
+config SIMPLE_MENU_HOOK
+menu "simple menu"
+endmenu
+
+config ADVANCED_MENU_HOOK
+menu "advanced menu"
+ depends on A
+ visible if B
+ visible if C || D
+endmenu
+
+config SIMPLE_COMMENT_HOOK
+comment "simple comment"
+
+config ADVANCED_COMMENT_HOOK
+comment "advanced comment"
+ depends on A
+ depends on B