Fix Doxyfile parsing when the first tag occurs on the first line.

Also, add a couple of regression tests.
This commit is contained in:
Richard van der Hoff 2013-08-12 15:38:49 +01:00 committed by Ichthyostega
parent 0d12211c55
commit 3926ea513a
2 changed files with 28 additions and 2 deletions

View file

@ -58,9 +58,9 @@ def DoxyfileParse(file_contents):
lineno = lex.lineno lineno = lex.lineno
token = lex.get_token() token = lex.get_token()
key = token # the first token should be a key key = None
last_token = "" last_token = ""
key_token = False key_token = True # the first token should be a key
next_key = False next_key = False
new_data = True new_data = True

26
test.py Executable file
View file

@ -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()