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

Function __create_compdb

test/cli/lookup_test.py:36–55  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

34
35
36def __create_compdb(tmpdir):
37 file_name = 'test.c'
38 test_file = os.path.join(tmpdir, file_name)
39 with open(test_file, 'wt'):
40 pass
41
42 compilation_db = [
43 {
44 "directory": str(tmpdir),
45 "command": "c++ -o {}.o -c {}".format(os.path.basename(file_name), file_name),
46 "file": file_name,
47 "output": "{}.o".format(os.path.basename(file_name))
48 }
49 ]
50
51 compile_commands = os.path.join(tmpdir, 'compile_commands.json')
52 with open(compile_commands, 'wt') as f:
53 f.write(json.dumps(compilation_db))
54
55 return compile_commands, test_file
56
57
58def test_lib_lookup(tmpdir):

Calls 4

strFunction · 0.85
formatMethod · 0.80
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected