forked from qt-creator/qt-creator
ClangTools: Fix plugin tests
The tests expected diagnostics from source files only, but provided also the ones from the header. FAIL! : ClangTools::Internal::ClangToolsUnitTests::testProject(qt-widgets-app.qbs) Compared values are not the same Actual (tool->diagnostics().count()): 4 Expected (expectedDiagCount) : 1 Loc: [/d1/creator/4.9/source/src/plugins/clangtools/clangtoolsunittests.cpp(133)] FAIL! : ClangTools::Internal::ClangToolsUnitTests::testProject(qt-widgets-app.pro) Compared values are not the same Actual (tool->diagnostics().count()): 4 Expected (expectedDiagCount) : 1 Loc: [/d1/creator/4.9/source/src/plugins/clangtools/clangtoolsunittests.cpp(133)] Change-Id: I9270ba8cb554af3a3254e21d55656e73bcae71dd Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/session.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fancymainwindow.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -137,7 +138,10 @@ void ClangTool::initDiagnosticView()
|
||||
|
||||
QSet<Diagnostic> ClangTool::diagnostics() const
|
||||
{
|
||||
return m_diagnosticModel->diagnostics();
|
||||
return Utils::filtered(m_diagnosticModel->diagnostics(), [](const Diagnostic &diagnostic) {
|
||||
using CppTools::ProjectFile;
|
||||
return ProjectFile::isSource(ProjectFile::classify(diagnostic.location.filePath));
|
||||
});
|
||||
}
|
||||
|
||||
void ClangTool::onNewDiagnosticsAvailable(const QList<Diagnostic> &diagnostics)
|
||||
|
Reference in New Issue
Block a user