Fix sense of test (.analyzerinfo files get placed in wrong directory) (#4486)

* Fix sense of test (.analyzerinfo files get placed in wrong directory)

* Update testanalyzerinformation.cpp

style (tabs -> spaces)
This commit is contained in:
Jim Kuhn 2022-09-21 11:38:23 -04:00 committed by GitHub
parent 3b07661fd3
commit f27fbdd8ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -120,7 +120,7 @@ std::string AnalyzerInformation::getAnalyzerInfoFile(const std::string &buildDir
const std::string::size_type pos = sourcefile.rfind('/');
std::string filename;
if (pos != std::string::npos)
if (pos == std::string::npos)
filename = sourcefile;
else
filename = sourcefile.substr(pos + 1);

View File

@ -38,6 +38,8 @@ private:
ASSERT_EQUALS("file1.a4", getAnalyzerInfoFileFromFilesTxt(f1, "file1.c", ""));
std::istringstream f2(filesTxt);
ASSERT_EQUALS("file1.a4", getAnalyzerInfoFileFromFilesTxt(f2, "./file1.c", ""));
ASSERT_EQUALS("builddir/file1.c.analyzerinfo", AnalyzerInformation::getAnalyzerInfoFile("builddir", "file1.c", ""));
ASSERT_EQUALS("builddir/file1.c.analyzerinfo", AnalyzerInformation::getAnalyzerInfoFile("builddir", "some/path/file1.c", ""));
}
};