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

Function __test_language

test/cli/dumpfile_test.py:27–46  ·  view source on GitHub ↗
(tmp_path, file_ext, exp_lang, force_lang=None)

Source from the content-addressed store, hash-verified

25
26
27def __test_language(tmp_path, file_ext, exp_lang, force_lang=None):
28 test_file = tmp_path / ('test.' + file_ext)
29 with open(test_file, 'wt'):
30 pass
31
32 args = [
33 '--dump',
34 str(test_file)
35 ]
36 if force_lang:
37 args += ['--language=' + force_lang]
38
39 exitcode, stdout, stderr = cppcheck(args)
40 assert exitcode == 0, stdout if stdout else stderr
41
42 dump_s = pathlib.Path(str(test_file) + '.dump').read_text()
43
44 dump_xml = ET.fromstring(dump_s)
45 assert 'language' in dump_xml.attrib
46 assert dump_xml.attrib['language'] == exp_lang
47
48
49def test_language_c(tmp_path):

Callers 12

test_language_cFunction · 0.85
test_language_c_force_cFunction · 0.85
test_language_cppFunction · 0.85
test_language_hFunction · 0.85
test_language_h_force_cFunction · 0.85
test_language_unkFunction · 0.85

Calls 2

cppcheckFunction · 0.90
strFunction · 0.85

Tested by

no test coverage detected