@@ -42,6 +42,7 @@ class TestImporter final : public ImportProject {
4242 using ImportProject::collectArgs;
4343 using ImportProject::fsSetDefines;
4444 using ImportProject::fsSetIncludePaths;
45+ using ImportProject::setRelativePaths;
4546};
4647
4748
@@ -56,6 +57,7 @@ class TestImportProject : public TestFixture {
5657 TEST_CASE (setIncludePaths1);
5758 TEST_CASE (setIncludePaths2);
5859 TEST_CASE (setIncludePaths3); // macro names are case insensitive
60+ TEST_CASE (setRelativePathsInclude); // #14746
5961 TEST_CASE (importCompileCommands1);
6062 TEST_CASE (importCompileCommands2); // #8563, #9567
6163 TEST_CASE (importCompileCommands3); // check with existing trailing / in directory
@@ -134,6 +136,17 @@ class TestImportProject : public TestFixture {
134136 ASSERT_EQUALS (" c:/abc/other/" , fs.includePaths .front ());
135137 }
136138
139+ void setRelativePathsInclude () const {
140+ const std::string cwd = Path::fromNativeSeparators (Path::getCurrentPath ());
141+ TestImporter importer;
142+ FileSettings fs{cwd + " /sub/a.c" , Standards::Language::None, 0 };
143+ fs.includePaths .push_back (cwd + " /" );
144+ importer.fileSettings .push_back (std::move (fs));
145+ importer.setRelativePaths (" project.json" );
146+ ASSERT_EQUALS (" ." , importer.fileSettings .cbegin ()->includePaths .front ());
147+ ASSERT_EQUALS (" sub/a.c" , importer.fileSettings .cbegin ()->filename ());
148+ }
149+
137150 void importCompileCommands1 () const {
138151 REDIRECT;
139152 constexpr char json[] = R"( [{
0 commit comments