Skip to content

Commit 7068c3a

Browse files
committed
add test
1 parent 0f2d722 commit 7068c3a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎test/tools/htmlreport/test_htmlreport.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,25 @@ def testEscape(self):
140140

141141
output_directory.cleanup()
142142

143+
def testPremiumLicenseMessage(self):
144+
with tempfile.TemporaryDirectory() as tmpdir:
145+
xml_filename = os.path.join(tmpdir, 'premium.xml')
146+
with open(xml_filename, 'w') as f:
147+
f.write('<?xml version="1.0" encoding="UTF-8"?>\n'
148+
'<results version="2"><cppcheck version="2.18"/><errors>\n'
149+
'<error id="premium-licenseExpiresSoon" severity="information" msg="license will expire" verbose="license will expire">\n'
150+
'<location file="Cppcheck Premium" line="0" column="0"/>\n'
151+
'</error>\n'
152+
'</errors></results>\n')
153+
output_directory = os.path.join(tmpdir, 'out')
154+
p = subprocess.run([*HTML_REPORT_BIN, '--file=' + xml_filename, '--report-dir=' + output_directory],
155+
capture_output=True, text=True, check=True)
156+
self.assertNotIn('not found', p.stderr)
157+
with open(os.path.join(output_directory, 'index.html')) as index_file:
158+
report = index_file.read()
159+
self.assertIn('license will expire', report)
160+
self.assertNotIn('0.html#line-0', report)
161+
143162

144163
@contextlib.contextmanager
145164
def runCheck(source_filename=None, xml_version='1', xml_filename=None, checkers_filename=None):

0 commit comments

Comments
 (0)