(tmp_path, file_name, extra_args, stdout_exp_1, content='')
| 140 | |
| 141 | |
| 142 | def __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 | |
| 168 | def test_cmd_c(tmp_path): |
no test coverage detected