Skip to content

Commit 70c79fe

Browse files
committed
Fix #14225 (addons; add optional "hash" attribute for warning messages)
1 parent 072d0d5 commit 70c79fe

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/cli/premium_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,20 @@ def test_invalid_license_retry(tmpdir):
156156

157157
_, _, stderr = cppcheck(args)
158158
assert 'Invalid license' not in stderr
159+
160+
161+
def test_hash(tmpdir):
162+
# Trac 14225 - warnings with hash
163+
test_file = os.path.join(tmpdir, 'test.c')
164+
addon_file = os.path.join(tmpdir, 'premiumaddon.py')
165+
166+
with open(test_file, 'wt') as f:
167+
f.write('void foo();\n')
168+
169+
args = [f"--addon={addon_file}", '--xml', test_file]
170+
171+
with open(addon_file, 'wt') as f:
172+
f.write('print(\'{"addon":"a","column":1,"errorId":"id","extra":"","file":"test.c","hash":123,"linenr":1,"message":"bug","severity":"error"}\')')
173+
174+
_, _, stderr = cppcheck(args)
175+
assert '<error id="a-id" severity="error" msg="bug" verbose="bug" hash="123" ' in stderr

0 commit comments

Comments
 (0)