mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 17:08:54 -06:00
unittest: adding support for Python- or GF-style comments
This commit is contained in:
@@ -69,7 +69,10 @@ def runtest(testlines):
|
|||||||
gfinput = ''
|
gfinput = ''
|
||||||
testing = False
|
testing = False
|
||||||
for linenr, line in enumerate(testlines, 1):
|
for linenr, line in enumerate(testlines, 1):
|
||||||
if ':' in line:
|
if line.startswith('#') or line.startswith('--'):
|
||||||
|
# a comment line: do nothing
|
||||||
|
pass
|
||||||
|
elif ':' in line:
|
||||||
if not testing:
|
if not testing:
|
||||||
gfinput += 'ps "### %d" \n' % (linenr,)
|
gfinput += 'ps "### %d" \n' % (linenr,)
|
||||||
testing = True
|
testing = True
|
||||||
@@ -82,6 +85,7 @@ def runtest(testlines):
|
|||||||
else:
|
else:
|
||||||
gfinput += 'p -lang=%s "%s" \n' % (lang, sent)
|
gfinput += 'p -lang=%s "%s" \n' % (lang, sent)
|
||||||
elif not line.strip():
|
elif not line.strip():
|
||||||
|
# an empty line: start a new test
|
||||||
testing = False
|
testing = False
|
||||||
else:
|
else:
|
||||||
error(linenr, "Ill-formatted line in test file:", line)
|
error(linenr, "Ill-formatted line in test file:", line)
|
||||||
|
|||||||
Reference in New Issue
Block a user