diff options
| -rw-r--r-- | kconfigtest.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kconfigtest.py b/kconfigtest.py index 3d1617b..f9cb275 100644 --- a/kconfigtest.py +++ b/kconfigtest.py @@ -134,6 +134,20 @@ def run_selftests(): assert_val("M", "m") assert_val("(Y || N) && (m && y)", "m") + # + # Text queries + # + + # TODO: Get rid of extra \n's at end of texts? + + print "Testing various text queries..." + c = kconfiglib.Config("Kconfiglib/tests/Ktext") + assert_equals(c["NO_HELP"].get_help(), None) + assert_equals(c["S"].get_help(), "help for\nS\n") + assert_equals(c.get_choices()[0].get_help(), "help for\nC\n") + assert_equals(c.get_comments()[0].get_text(), "a comment") + assert_equals(c.get_menus()[0].get_title(), "a menu") + print def run_compatibility_tests(): @@ -590,6 +604,11 @@ def assert_false(cond, msg): if cond: fail(msg) +def assert_equals(x, y): + """Fails if 'x' does not equal 'y'.""" + if x != y: + fail("'{0}' does not equal '{1}'".format(x, y)) + def fail(msg = None): global _all_ok if msg is not None: |
