@@ -58,6 +58,7 @@ class TestImportProject : public TestFixture {
5858 TEST_CASE (importCompileCommands7); // linux: "/home/danielm/cppcheck 2"
5959 TEST_CASE (importCompileCommands8); // Windows: "C:\Users\danielm\cppcheck"
6060 TEST_CASE (importCompileCommands9);
61+ TEST_CASE (importCompileCommands10); // #10887: include path with space
6162 TEST_CASE (importCompileCommandsArgumentsSection); // Handle arguments section
6263 TEST_CASE (importCompileCommandsNoCommandSection); // gracefully handles malformed json
6364 TEST_CASE (importCppcheckGuiProject);
@@ -254,13 +255,33 @@ class TestImportProject : public TestFixture {
254255 "powershell.exe -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -File d:\\Projekte\\xyz\\firmware\\app\\xyz-lib\\build.ps1 -IAR -COMPILER_PATH \"c:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 9.0\" -CONTROLLER CC1310F128 -LIB LIB_PERMANENT -COMPILER_DEFINES \"CC1310_HFXO_FREQ=24000000 DEBUG\""
255256 ],
256257 "directory" : "d:\\Projekte\\xyz\\firmware\\app",
257- "type" : "PRE"
258+ "type" : "PRE",
259+ "file": "1.c"
258260 }])" ;
259261 std::istringstream istr (json);
260262 TestImporter importer;
261263 ASSERT_EQUALS (true , importer.importCompileCommands (istr));
262264 }
263265
266+ void importCompileCommands10 () const { // #10887
267+ const char json[] =
268+ R"( [{
269+ "file": "/home/danielm/cppcheck/1/test folder/1.c" ,
270+ "directory": "",
271+ "arguments": [
272+ "iccavr.exe",
273+ "-I",
274+ "/home/danielm/cppcheck/test folder"
275+ ]
276+ }])" ;
277+ std::istringstream istr (json);
278+ TestImporter importer;
279+ ASSERT_EQUALS (true , importer.importCompileCommands (istr));
280+ ASSERT_EQUALS (1 , importer.fileSettings .size ());
281+ const ImportProject::FileSettings &fs = importer.fileSettings .front ();
282+ ASSERT_EQUALS (" /home/danielm/cppcheck/test folder/" , fs.includePaths .front ());
283+ }
284+
264285 void importCompileCommandsArgumentsSection () const {
265286 const char json[] = " [ { \" directory\" : \" /tmp/\" ,"
266287 " \" arguments\" : [\" gcc\" , \" -c\" , \" src.c\" ],"
0 commit comments