MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / test_hash

Function test_hash

test/cli/premium_test.py:187–201  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

185
186
187def test_hash(tmpdir):
188 # Trac 14225 - warnings with hash
189 test_file = os.path.join(tmpdir, 'test.c')
190 addon_file = os.path.join(tmpdir, 'premiumaddon.py')
191
192 with open(test_file, 'wt') as f:
193 f.write('void foo();\n')
194
195 args = [f"--addon={addon_file}", '--xml', test_file]
196
197 with open(addon_file, 'wt') as f:
198 f.write('print(\'{"addon":"a","column":1,"errorId":"id","extra":"","file":"test.c","hash":123,"linenr":1,"message":"bug","severity":"error"}\')')
199
200 _, _, stderr = cppcheck(args)
201 assert '<error id="a-id" severity="error" msg="bug" verbose="bug" hash="123" ' in stderr

Callers

nothing calls this directly

Calls 3

cppcheckFunction · 0.90
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected