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

Function __test_cmd

test/cli/clang-import_test.py:142–165  ·  view source on GitHub ↗
(tmp_path, file_name, extra_args, stdout_exp_1, content='')

Source from the content-addressed store, hash-verified

140
141
142def __test_cmd(tmp_path, file_name, extra_args, stdout_exp_1, content=''):
143 test_file = tmp_path / file_name
144 with open(test_file, 'wt') as f:
145 f.write(content)
146
147 args = [
148 '--enable=information',
149 '--verbose',
150 '--clang',
151 file_name
152 ]
153
154 args += extra_args
155
156 if stdout_exp_1:
157 stdout_exp_1 += ' '
158
159 exitcode, stdout, stderr = cppcheck(args, cwd=tmp_path)
160 assert exitcode == 0, stderr if not stdout else stdout
161 assert stderr == ''
162 assert stdout.splitlines() == [
163 'Checking {} ...'.format(file_name),
164 'clang -fsyntax-only -Xclang -ast-dump -fno-color-diagnostics {}{}'.format(stdout_exp_1, file_name)
165 ]
166
167
168def test_cmd_c(tmp_path):

Callers 15

test_cmd_cFunction · 0.85
test_cmd_cppFunction · 0.85
test_cmd_unkFunction · 0.85
test_cmd_hdrFunction · 0.85
test_cmd_hdr_probeFunction · 0.85
test_cmd_incFunction · 0.85
test_cmd_defFunction · 0.85
test_cmd_includeFunction · 0.85
test_cmd_enforce_cFunction · 0.85
test_cmd_enforce_cppFunction · 0.85
test_cmd_std_cFunction · 0.85
test_cmd_std_c_builddirFunction · 0.85

Calls 3

cppcheckFunction · 0.90
formatMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected