Skip to content

Commit 9191eee

Browse files
committed
add test
1 parent 4780cd2 commit 9191eee

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

test/cli/other_test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,30 @@ 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+
with open(addon_json, 'wt') as f:
250+
f.write(json.dumps({'executable': 'C:\\Users\\User\\A Folder\\addon.exe'}))
251+
252+
test_file = os.path.join(tmpdir, 'test.cpp')
253+
with open(test_file, 'wt') as f:
254+
pass
255+
256+
args = [
257+
'--addon={}'.format(addon_json),
258+
test_file,
259+
'--verbose',
260+
'--debug'
261+
]
262+
263+
_, _, stderr = cppcheck(args)
264+
ec = 1 if os.name == 'nt' else 127
265+
266+
# Make sure the full command is used
267+
assert '\'"C:\\Users\\User\\A Folder\\addon.exe"\' is not recognized as an internal or external command, operable program or batch file.' in stderr
268+
269+
246270
def test_execute_addon_failure_json_ctu_notexist(tmpdir):
247271
# specify non-existent python executable so execution of addon fails
248272
addon_json = os.path.join(tmpdir, 'addon.json')

0 commit comments

Comments
 (0)