From 3926ea513a99ac408a7785e89fd2b0f03dbcf080 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 12 Aug 2013 15:38:49 +0100 Subject: [PATCH] Fix Doxyfile parsing when the first tag occurs on the first line. Also, add a couple of regression tests. --- doxygen.py | 4 ++-- test.py | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100755 test.py diff --git a/doxygen.py b/doxygen.py index 47907fddf..28ce3a9d5 100644 --- a/doxygen.py +++ b/doxygen.py @@ -58,9 +58,9 @@ def DoxyfileParse(file_contents): lineno = lex.lineno token = lex.get_token() - key = token # the first token should be a key + key = None last_token = "" - key_token = False + key_token = True # the first token should be a key next_key = False new_data = True diff --git a/test.py b/test.py new file mode 100755 index 000000000..eb0a89c27 --- /dev/null +++ b/test.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# +# tests for scons doxygen builder +# + +import unittest +import os +import sys +from doxygen import DoxyfileParse + +class TestParser(unittest.TestCase): + def testSimpleParse(self): + text=""" +INPUT = test.h +""" + result = DoxyfileParse(text) + self.assertEqual(["test.h"], result["INPUT"]) + + def testParseTagOnFirstLine(self): + text="""INPUT=.""" + result = DoxyfileParse(text) + self.assertEqual(["."], result["INPUT"]) + + +if __name__ == '__main__': + unittest.main()