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

Function __test_addon_json_invalid

test/cli/other_test.py:1535–1553  ·  view source on GitHub ↗
(tmpdir, addon_json, expected)

Source from the content-addressed store, hash-verified

1533
1534
1535def __test_addon_json_invalid(tmpdir, addon_json, expected):
1536 addon_file = os.path.join(tmpdir, 'invalid.json')
1537 with open(addon_file, 'wt') as f:
1538 f.write(addon_json)
1539
1540 test_file = os.path.join(tmpdir, 'file.cpp')
1541 with open(test_file, 'wt'):
1542 pass
1543
1544 args = ['--addon={}'.format(addon_file), test_file]
1545
1546 exitcode, stdout, stderr = cppcheck(args)
1547 assert exitcode == 1
1548 lines = stdout.splitlines()
1549 assert len(lines) == 1
1550 assert lines == [
1551 'Loading {} failed. {}'.format(addon_file, expected)
1552 ]
1553 assert stderr == ''
1554
1555
1556def test_addon_json_invalid_no_obj(tmpdir):

Calls 4

cppcheckFunction · 0.90
formatMethod · 0.80
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected