diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-05-27 23:58:47 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-05-27 23:58:47 +0200 |
| commit | fc73c461f1a8acf3e09670e8f9429c7ef9d0b71f (patch) | |
| tree | fed01e7cc8e5caca2c790d0b14d3665887e91961 /testsuite.py | |
| parent | 94020beb311eb8a9db9e3b841e36c96b1b0f72dd (diff) | |
Provide lists with all menus and comments
Handy e.g. when implementing advanced search features.
Diffstat (limited to 'testsuite.py')
| -rw-r--r-- | testsuite.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/testsuite.py b/testsuite.py index 9909e1e..1f0ef64 100644 --- a/testsuite.py +++ b/testsuite.py @@ -41,7 +41,7 @@ # All tests should pass. Report regressions to ulfalizer a.t Google's email # service. -from kconfiglib import Kconfig, Symbol, Choice, COMMENT, MENU, \ +from kconfiglib import Kconfig, Symbol, Choice, COMMENT, MENU, MenuNode, \ BOOL, TRISTATE, HEX, STRING, \ TRI_TO_STR, \ escape, unescape, \ @@ -957,6 +957,27 @@ g fail("recursive 'source' did not raise exception") + print("Testing Kconfig.choices/menus/comments") + + c = Kconfig("Kconfiglib/tests/Kitemlists") + + def verify_prompts(items, *expected_prompts): + verify(len(items) == len(expected_prompts), + "Wrong number of prompts for {}".format(items)) + + for item, expected_prompt in zip(items, expected_prompts): + if not isinstance(item, MenuNode): + item = item.nodes[0] + + verify(item.prompt[0] == expected_prompt, + "Wrong prompt for {}, expected '{}'" + .format(repr(item), expected_prompt)) + + verify_prompts(c.choices, "choice 1", "choice 2", "choice 3") + verify_prompts(c.menus, "menu 1", "menu 2", "menu 3", "menu 4", "menu 5") + verify_prompts(c.comments, "comment 1", "comment 2", "comment 3") + + print("Testing Symbol/Choice.direct_dep") c = Kconfig("Kconfiglib/tests/Kdirdep") |
