From 7cbe4e78106398f854452524e3cea8422675fbcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Ljunglo=CC=88f?= Date: Fri, 12 Jul 2019 10:38:01 +0200 Subject: [PATCH] unittest: adding support for Python- or GF-style comments --- unittest/unittest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unittest/unittest.py b/unittest/unittest.py index 4b2c0acc3..199e4ca2c 100644 --- a/unittest/unittest.py +++ b/unittest/unittest.py @@ -69,7 +69,10 @@ def runtest(testlines): gfinput = '' testing = False 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: gfinput += 'ps "### %d" \n' % (linenr,) testing = True @@ -82,6 +85,7 @@ def runtest(testlines): else: gfinput += 'p -lang=%s "%s" \n' % (lang, sent) elif not line.strip(): + # an empty line: start a new test testing = False else: error(linenr, "Ill-formatted line in test file:", line)