From e15304917c21fbc1d83b02e6ca2e9eb0c8f1963c Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Thu, 23 Jul 2015 21:54:12 +0200 Subject: Add .config header continuation line test. Mostly to get coverage for _FileFeed.peek_next(), which is only used while reading the header. The tested behavior probably doesn't make much sense for .config files and stems from _FileFeed reuse. It's fairly obscure at least. --- tests/config_continuation | 7 +++++++ testsuite.py | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/config_continuation diff --git a/tests/config_continuation b/tests/config_continuation new file mode 100644 index 0000000..5dd78cc --- /dev/null +++ b/tests/config_continuation @@ -0,0 +1,7 @@ +# Foo \ +# Bar +# Baz \ +# Foo \ +# Bar +# Baz +# Foo diff --git a/testsuite.py b/testsuite.py index 6863bbb..e08743c 100644 --- a/testsuite.py +++ b/testsuite.py @@ -1519,6 +1519,19 @@ def run_selftests(): "Expected empty header in file with just '#', got '{0}'". format(c.get_config_header())) + # TODO: Line joining (which stems from _FileFeed reuse) probably doesn't + # make sense within .config files. (The C implementation has no notion of + # continuation lines within .config files.) It's harmless except for fairly + # obscure cases though. + # + # Add a test for now just to get test coverage for _FileFeed.peek_next(), + # which is only used while reading .config files as of writing. + + c.load_config("Kconfiglib/tests/config_continuation") + verify(c.get_config_header() == + " Foo # Bar\n Baz # Foo # Bar\n Baz\n Foo", + "Continuation line handling within .config headers is broken") + # Appending values from a .config c = kconfiglib.Config("Kconfiglib/tests/Kappend") -- cgit v1.2.3