Skip to content

Commit 8ecd18f

Browse files
committed
add test
1 parent 4780cd2 commit 8ecd18f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/cli/other_test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,31 @@ def test_execute_addon_failure_json_notexist(tmpdir):
243243
assert stderr == "{}:0:0: error: Bailing out from analysis: Checking file failed: Failed to execute addon 'addon.json' - exitcode is {} [internalError]\n\n^\n".format(test_file, ec)
244244

245245

246+
@pytest.mark.skipif(sys.platform != "win32", reason="Windows specific issue")
247+
def test_execute_addon_path_with_spaces(tmpdir):
248+
addon_json = os.path.join(tmpdir, 'addon.json')
249+
addon_executable = os.path.join(tmpdir, 'A Folder', 'addon.exe')
250+
with open(addon_json, 'wt') as f:
251+
f.write(json.dumps({'executable': addon_executable }))
252+
253+
test_file = os.path.join(tmpdir, 'test.cpp')
254+
with open(test_file, 'wt') as f:
255+
pass
256+
257+
args = [
258+
'--addon={}'.format(addon_json),
259+
test_file,
260+
'--verbose',
261+
'--debug'
262+
]
263+
264+
_, _, stderr = cppcheck(args)
265+
ec = 1 if os.name == 'nt' else 127
266+
267+
# Make sure the full command is used
268+
assert 'The system cannot find the path specified. [internalError]' in stderr
269+
270+
246271
def test_execute_addon_failure_json_ctu_notexist(tmpdir):
247272
# specify non-existent python executable so execution of addon fails
248273
addon_json = os.path.join(tmpdir, 'addon.json')

0 commit comments

Comments
 (0)