diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-06 23:29:54 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-06 23:29:54 +0100 |
| commit | c85d164702ac780bbc8318a0b46f674bb33eaf00 (patch) | |
| tree | 19899632dd3a98ca524e6e1311c75cfa3ee45745 | |
| parent | db8a3650ffae0b659d819c0d453546655ae0a4c3 (diff) | |
Add selftests for various text queries.
| -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: |
