@@ -66,6 +66,7 @@ class TestImportProject : public TestFixture {
6666 TEST_CASE (importCompileCommands12); // #13040: "directory" is parent directory, relative include paths
6767 TEST_CASE (importCompileCommands13); // #13333: duplicate file entries
6868 TEST_CASE (importCompileCommands14); // #14156
69+ TEST_CASE (importCompileCommands15); // #14306
6970 TEST_CASE (importCompileCommandsArgumentsSection); // Handle arguments section
7071 TEST_CASE (importCompileCommandsNoCommandSection); // gracefully handles malformed json
7172 TEST_CASE (importCompileCommandsDirectoryMissing); // 'directory' field missing
@@ -389,6 +390,26 @@ class TestImportProject : public TestFixture {
389390 ASSERT_EQUALS (" TFS_LINUX_MODULE_NAME=\" tfs_linux\" " , fs.defines );
390391 }
391392
393+ void importCompileCommands15 () const { // #14306
394+ REDIRECT;
395+ constexpr char json[] =
396+ R"( [
397+ {
398+ "directory": "C:\\Users\\abcd\\efg\\hijk",
399+ "command": "gcc \"-Ipath\\123\" \"-c\" test.c",
400+ "file": "test.c",
401+ "output": "test.obj"
402+ }
403+ ])" ;
404+ std::istringstream istr (json);
405+ TestImporter importer;
406+ ASSERT_EQUALS (true , importer.importCompileCommands (istr));
407+ ASSERT_EQUALS (1 , importer.fileSettings .size ());
408+ const FileSettings &fs = importer.fileSettings .front ();
409+ ASSERT_EQUALS (1 , fs.includePaths .size ());
410+ ASSERT_EQUALS (" C:/Users/abcd/efg/hijk/path/123/" , fs.includePaths .front ());
411+ }
412+
392413 void importCompileCommandsArgumentsSection () const {
393414 REDIRECT;
394415 constexpr char json[] = " [ { \" directory\" : \" /tmp/\" ,"
0 commit comments