提交 49ac3c0c 编写于 作者: M Masahiro Yamada

kconfig: tests: test automatic submenu creation

If a symbols has dependency on the preceding symbol, the menu entry
should become the submenu of the preceding one, and displayed with
deeper indentation.

This is done by restructuring the menu tree in menu_finalize().
It is a bit complicated computation, so let's add a test case.
Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
上级 1903c511
config A
bool "A"
default y
config A0
bool "A0"
depends on A
default y
help
This depends on A, so should be a submenu of A.
config A0_0
bool "A1_0"
depends on A0
help
Submenus are created recursively.
This should be a submenu of A0.
config A1
bool "A1"
depends on A
default y
help
This should line up with A0.
choice
prompt "choice"
depends on A1
help
Choice should become a submenu as well.
config A1_0
bool "A1_0"
config A1_1
bool "A1_1"
endchoice
config B
bool "B"
help
This is independent of A.
config C
bool "C"
depends on A
help
This depends on A, but not a consecutive item, so can/should not
be a submenu.
"""
Create submenu for symbols that depend on the preceding one.
If a symbols has dependency on the preceding symbol, the menu entry
should become the submenu of the preceding one, and displayed with
deeper indentation.
"""
def test(conf):
assert conf.oldaskconfig() == 0
assert conf.stdout_contains('expected_stdout')
A (A) [Y/n/?] (NEW)
A0 (A0) [Y/n/?] (NEW)
A1_0 (A0_0) [N/y/?] (NEW)
A1 (A1) [Y/n/?] (NEW)
choice
> 1. A1_0 (A1_0) (NEW)
2. A1_1 (A1_1) (NEW)
choice[1-2?]:
B (B) [N/y/?] (NEW)
C (C) [N/y/?] (NEW)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册