UnitTest: Cleanup

Improve naming and introduce googletest.h.

Change-Id: I445c13db4c23d6dd5682ce0db3b83055cc6b8a89
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2016-09-15 17:41:41 +02:00
parent f717064a91
commit 47c01daeb2
67 changed files with 227 additions and 348 deletions

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangactivationsequencecontextprocessor.h> #include <clangactivationsequencecontextprocessor.h>
#include <clangcodemodel/clangcompletionassistinterface.h> #include <clangcodemodel/clangcompletionassistinterface.h>
@@ -32,11 +34,6 @@
#include <QTextCursor> #include <QTextCursor>
#include <QTextDocument> #include <QTextDocument>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
using ContextProcessor = ClangCodeModel::Internal::ActivationSequenceContextProcessor; using ContextProcessor = ClangCodeModel::Internal::ActivationSequenceContextProcessor;

View File

@@ -23,15 +23,12 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangactivationsequenceprocessor.h> #include <clangactivationsequenceprocessor.h>
#include <cplusplus/Token.h> #include <cplusplus/Token.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
using testing::PrintToString; using testing::PrintToString;

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "chunksreportedmonitor.h" #include "chunksreportedmonitor.h"
#include <QSignalSpy> #include <QSignalSpy>
@@ -43,10 +45,8 @@ bool ChunksReportedMonitor::waitUntilFinished(int timeoutInMs)
return spy.wait(timeoutInMs); return spy.wait(timeoutInMs);
} }
void ChunksReportedMonitor::onResultsReadyAt(int beginIndex, int endIndex) void ChunksReportedMonitor::onResultsReadyAt(int, int)
{ {
Q_UNUSED(beginIndex)
Q_UNUSED(endIndex)
++m_resultsReadyCounter; ++m_resultsReadyCounter;
} }

View File

@@ -23,8 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "clangasyncjobtest.h" #include "clangasyncjob-base.h"
#include "testutils.h" #include "processevents-utilities.h"
#include <clangbackendipc/filecontainer.h> #include <clangbackendipc/filecontainer.h>
@@ -66,5 +66,5 @@ bool ClangAsyncJobTest::waitUntilJobFinished(const ClangBackEnd::IAsyncJob &asyn
{ {
const auto isOnFinishedSlotExecuted = [&asyncJob](){ return asyncJob.isFinished(); }; const auto isOnFinishedSlotExecuted = [&asyncJob](){ return asyncJob.isFinished(); };
return TestUtils::processEventsUntilTrue(isOnFinishedSlotExecuted, timeOutInMs); return ProcessEventUtilities::processEventsUntilTrue(isOnFinishedSlotExecuted, timeOutInMs);
} }

View File

@@ -25,21 +25,18 @@
#pragma once #pragma once
#include "googletest.h"
#include "dummyclangipcclient.h" #include "dummyclangipcclient.h"
#include "mockclangcodemodelclient.h" #include "mockclangcodemodelclient.h"
#include "clangiasyncjob.h"
#include <clangdocument.h> #include <clangdocument.h>
#include <clangiasyncjob.h>
#include <clangjobrequest.h> #include <clangjobrequest.h>
#include <projects.h> #include <projects.h>
#include <clangdocuments.h> #include <clangdocuments.h>
#include <unsavedfiles.h> #include <unsavedfiles.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
class ClangAsyncJobTest : public ::testing::Test class ClangAsyncJobTest : public ::testing::Test
{ {
protected: protected:

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangcodecompleteresults.h> #include <clangcodecompleteresults.h>
#include <clangdocument.h> #include <clangdocument.h>
#include <clangfilepath.h> #include <clangfilepath.h>
@@ -36,11 +38,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
using ClangBackEnd::ClangCodeCompleteResults; using ClangBackEnd::ClangCodeCompleteResults;

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "clangasyncjobtest.h" #include "clangasyncjob-base.h"
#include <clangcompletecodejob.h> #include <clangcompletecodejob.h>

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangcodemodel/clangcompletioncontextanalyzer.h> #include <clangcodemodel/clangcompletioncontextanalyzer.h>
#include <clangcodemodel/clangcompletionassistinterface.h> #include <clangcodemodel/clangcompletionassistinterface.h>
@@ -30,11 +32,6 @@
#include <QTextDocument> #include <QTextDocument>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace ClangCodeModel { namespace ClangCodeModel {
namespace Internal { namespace Internal {

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "clangasyncjobtest.h" #include "clangasyncjob-base.h"
#include <clangcreateinitialdocumentpreamblejob.h> #include <clangcreateinitialdocumentpreamblejob.h>

View File

@@ -23,15 +23,12 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangdiagnosticfilter.h> #include <clangdiagnosticfilter.h>
#include <diagnosticcontainer.h> #include <diagnosticcontainer.h>
#include <fixitcontainer.h> #include <fixitcontainer.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
using ::testing::Contains; using ::testing::Contains;

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangfilepath.h> #include <clangfilepath.h>
#include <clangtranslationunitupdater.h> #include <clangtranslationunitupdater.h>
#include <commandlinearguments.h> #include <commandlinearguments.h>
@@ -41,11 +43,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
#include <QTemporaryFile> #include <QTemporaryFile>
#include <chrono> #include <chrono>

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <projectpart.h> #include <projectpart.h>
#include <clangexceptions.h> #include <clangexceptions.h>
#include <projects.h> #include <projects.h>
@@ -33,11 +35,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::Document; using ClangBackEnd::Document;
using ClangBackEnd::UnsavedFiles; using ClangBackEnd::UnsavedFiles;
using ClangBackEnd::ProjectPart; using ClangBackEnd::ProjectPart;

View File

@@ -23,10 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "gtest/gtest.h" #include "googletest.h"
#include "gmock/gmock-matchers.h"
#include "gmock/gmock.h"
#include "gtest-qt-printing.h"
#include <clangfixitoperation.h> #include <clangfixitoperation.h>
#include <fixitcontainer.h> #include <fixitcontainer.h>

View File

@@ -23,8 +23,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "mockclangcodemodelclient.h" #include "mockclangcodemodelclient.h"
#include "testutils.h" #include "processevents-utilities.h"
#include <clangcodemodelserver.h> #include <clangcodemodelserver.h>
#include <highlightingmarkcontainer.h> #include <highlightingmarkcontainer.h>
@@ -41,11 +43,6 @@
#include <QFile> #include <QFile>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using testing::Property; using testing::Property;
using testing::Contains; using testing::Contains;
using testing::Not; using testing::Not;
@@ -331,7 +328,7 @@ bool ClangClangCodeModelServer::waitUntilAllJobsFinished(int timeOutInMs)
&& !clangServer.isTimerRunningForTestOnly(); && !clangServer.isTimerRunningForTestOnly();
}; };
return TestUtils::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs); return ProcessEventUtilities::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs);
} }
void ClangClangCodeModelServer::registerProjectAndFilesAndWaitForFinished( void ClangClangCodeModelServer::registerProjectAndFilesAndWaitForFinished(

View File

@@ -23,14 +23,11 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangisdiagnosticrelatedtolocation.h> #include <clangisdiagnosticrelatedtolocation.h>
#include <diagnosticcontainer.h> #include <diagnosticcontainer.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::DiagnosticContainer; using ClangBackEnd::DiagnosticContainer;
using ClangBackEnd::SourceLocationContainer; using ClangBackEnd::SourceLocationContainer;
using ClangBackEnd::SourceRangeContainer; using ClangBackEnd::SourceRangeContainer;

View File

@@ -23,7 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "testutils.h" #include "googletest.h"
#include "processevents-utilities.h"
#include <clangdocument.h> #include <clangdocument.h>
#include <clangdocuments.h> #include <clangdocuments.h>
@@ -35,11 +36,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
#include <QTemporaryFile> #include <QTemporaryFile>
using namespace ClangBackEnd; using namespace ClangBackEnd;

View File

@@ -23,7 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "testutils.h" #include "googletest.h"
#include "processevents-utilities.h"
#include "dummyclangipcclient.h" #include "dummyclangipcclient.h"
#include <clangdocument.h> #include <clangdocument.h>
@@ -36,11 +37,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using namespace ClangBackEnd; using namespace ClangBackEnd;
using testing::IsNull; using testing::IsNull;
@@ -136,7 +132,7 @@ bool Jobs::waitUntilAllJobsFinished(int timeOutInMs) const
{ {
const auto noJobsRunningAnymore = [this](){ return jobs.runningJobs() == 0; }; const auto noJobsRunningAnymore = [this](){ return jobs.runningJobs() == 0; };
return TestUtils::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs); return ProcessEventUtilities::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs);
} }
bool Jobs::waitUntilJobChainFinished(int timeOutInMs) const bool Jobs::waitUntilJobChainFinished(int timeOutInMs) const
@@ -145,7 +141,7 @@ bool Jobs::waitUntilJobChainFinished(int timeOutInMs) const
return jobs.runningJobs() == 0 && jobs.queue().isEmpty(); return jobs.runningJobs() == 0 && jobs.queue().isEmpty();
}; };
return TestUtils::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs); return ProcessEventUtilities::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs);
} }
JobRequest Jobs::createJobRequest(const Utf8String &filePath, JobRequest Jobs::createJobRequest(const Utf8String &filePath,

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "clangasyncjobtest.h" #include "clangasyncjob-base.h"
#include <clangrequestdocumentannotationsjob.h> #include <clangrequestdocumentannotationsjob.h>

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangstring.h> #include <clangstring.h>
#include <utf8string.h> #include <utf8string.h>
@@ -30,11 +32,6 @@
#include <clang-c/CXString.h> #include <clang-c/CXString.h>
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
using ::testing::StrEq; using ::testing::StrEq;

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "clangasyncjobtest.h" #include "clangasyncjob-base.h"
#include <clangupdatedocumentannotationsjob.h> #include <clangupdatedocumentannotationsjob.h>

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "mockclangcodemodelclient.h" #include "mockclangcodemodelclient.h"
#include "mockclangcodemodelserver.h" #include "mockclangcodemodelserver.h"
@@ -55,11 +57,6 @@
#include <vector> #include <vector>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using namespace ClangBackEnd; using namespace ClangBackEnd;
namespace { namespace {

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "mockclangcodemodelclient.h" #include "mockclangcodemodelclient.h"
#include <cmbalivemessage.h> #include <cmbalivemessage.h>
@@ -41,11 +43,6 @@
#include <translationunitdoesnotexistmessage.h> #include <translationunitdoesnotexistmessage.h>
#include <writemessageblock.h> #include <writemessageblock.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <QBuffer> #include <QBuffer>

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <codecompleter.h> #include <codecompleter.h>
#include <clangdocument.h> #include <clangdocument.h>
#include <filecontainer.h> #include <filecontainer.h>
@@ -36,11 +38,6 @@
#include <QFile> #include <QFile>
#include <QTemporaryDir> #include <QTemporaryDir>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ::testing::ElementsAreArray; using ::testing::ElementsAreArray;
using ::testing::Contains; using ::testing::Contains;
using ::testing::AllOf; using ::testing::AllOf;

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangcodecompleteresults.h> #include <clangcodecompleteresults.h>
#include <clangdocument.h> #include <clangdocument.h>
#include <clangfilepath.h> #include <clangfilepath.h>
@@ -40,11 +42,6 @@
#include <QFile> #include <QFile>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::CodeCompletionsExtractor; using ClangBackEnd::CodeCompletionsExtractor;
using ClangBackEnd::ClangCodeCompleteResults; using ClangBackEnd::ClangCodeCompleteResults;
using ClangBackEnd::FilePath; using ClangBackEnd::FilePath;

View File

@@ -23,14 +23,11 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <codecompletionchunk.h> #include <codecompletionchunk.h>
#include <clangcompletionchunkstotextconverter.h> #include <clangcompletionchunkstotextconverter.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
using ClangBackEnd::CodeCompletionChunk; using ClangBackEnd::CodeCompletionChunk;

View File

@@ -23,9 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "gtest/gtest.h" #include "googletest.h"
#include "gmock/gmock-matchers.h"
#include "gtest-qt-printing.h"
#include <QString> #include <QString>

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangdocument.h> #include <clangdocument.h>
#include <clangdocuments.h> #include <clangdocuments.h>
#include <clangstring.h> #include <clangstring.h>
@@ -34,11 +36,6 @@
#include <clangtranslationunit.h> #include <clangtranslationunit.h>
#include <unsavedfiles.h> #include <unsavedfiles.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::Cursor; using ClangBackEnd::Cursor;
using ClangBackEnd::Document; using ClangBackEnd::Document;
using ClangBackEnd::TranslationUnit; using ClangBackEnd::TranslationUnit;

View File

@@ -23,6 +23,9 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "diagnosticcontainer-matcher.h"
#include <diagnostic.h> #include <diagnostic.h>
#include <diagnosticcontainer.h> #include <diagnosticcontainer.h>
#include <diagnosticset.h> #include <diagnosticset.h>
@@ -38,12 +41,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
#include "matcher-diagnosticcontainer.h"
using ::testing::Contains; using ::testing::Contains;
using ::testing::Not; using ::testing::Not;

View File

@@ -23,6 +23,9 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "diagnosticcontainer-matcher.h"
#include <clangbackendipc_global.h> #include <clangbackendipc_global.h>
#include <clangdocument.h> #include <clangdocument.h>
#include <diagnosticcontainer.h> #include <diagnosticcontainer.h>
@@ -39,12 +42,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "matcher-diagnosticcontainer.h"
#include "gtest-qt-printing.h"
using ::testing::Contains; using ::testing::Contains;
using ::testing::Not; using ::testing::Not;
using ::testing::PrintToString; using ::testing::PrintToString;

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <diagnostic.h> #include <diagnostic.h>
#include <diagnosticset.h> #include <diagnosticset.h>
#include <projectpart.h> #include <projectpart.h>
@@ -37,11 +39,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::DiagnosticSet; using ClangBackEnd::DiagnosticSet;
using ClangBackEnd::Document; using ClangBackEnd::Document;
using ClangBackEnd::TranslationUnit; using ClangBackEnd::TranslationUnit;

View File

@@ -0,0 +1,31 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangdocument.h> #include <clangdocument.h>
#include <clangdocuments.h> #include <clangdocuments.h>
#include <clangtranslationunit.h> #include <clangtranslationunit.h>
@@ -39,11 +41,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::Cursor; using ClangBackEnd::Cursor;
using ClangBackEnd::HighlightingTypes; using ClangBackEnd::HighlightingTypes;
using ClangBackEnd::HighlightingMark; using ClangBackEnd::HighlightingMark;

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <chunksreportedmonitor.h> #include <chunksreportedmonitor.h>
#include <clangdocument.h> #include <clangdocument.h>
#include <clangdocuments.h> #include <clangdocuments.h>
@@ -34,11 +36,6 @@
#include <projects.h> #include <projects.h>
#include <unsavedfiles.h> #include <unsavedfiles.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::Cursor; using ClangBackEnd::Cursor;
using ClangBackEnd::HighlightingMarks; using ClangBackEnd::HighlightingMarks;
using ClangBackEnd::HighlightingMarkContainer; using ClangBackEnd::HighlightingMarkContainer;

View File

@@ -23,13 +23,11 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <lineprefixer.h> #include <lineprefixer.h>
#include <utf8string.h> #include <utf8string.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
QByteArray runPrefixer(QList<QByteArray> inputChunks); QByteArray runPrefixer(QList<QByteArray> inputChunks);

View File

@@ -32,7 +32,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "gtest-qt-printing.h" #include "gtest-qt-printing.h"
class RefactoringClientCallBackMock class MockRefactoringClientCallBack
{ {
public: public:
MOCK_METHOD3(localRenaming, MOCK_METHOD3(localRenaming,

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "testutils.h" #include "processevents-utilities.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QThread> #include <QThread>
@@ -31,7 +31,9 @@
#include <QDebug> #include <QDebug>
bool TestUtils::processEventsUntilTrue(std::function<bool ()> condition, int timeOutInMs) namespace ProcessEventUtilities
{
bool processEventsUntilTrue(std::function<bool ()> condition, int timeOutInMs)
{ {
if (condition()) if (condition())
return true; return true;
@@ -52,3 +54,4 @@ bool TestUtils::processEventsUntilTrue(std::function<bool ()> condition, int tim
QCoreApplication::processEvents(); QCoreApplication::processEvents();
} }
} }
}

View File

@@ -27,8 +27,7 @@
#include <functional> #include <functional>
class TestUtils namespace ProcessEventUtilities
{ {
public: bool processEventsUntilTrue(std::function<bool ()> condition, int timeOutInMs);
static bool processEventsUntilTrue(std::function<bool ()> condition, int timeOutInMs); }
};

View File

@@ -23,16 +23,13 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <projectpart.h> #include <projectpart.h>
#include <clangexceptions.h> #include <clangexceptions.h>
#include <projects.h> #include <projects.h>
#include <utf8stringvector.h> #include <utf8stringvector.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
#include <chrono> #include <chrono>
#include <thread> #include <thread>

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <cmbalivemessage.h> #include <cmbalivemessage.h>
#include <cmbcodecompletedmessage.h> #include <cmbcodecompletedmessage.h>
#include <cmbcompletecodemessage.h> #include <cmbcompletecodemessage.h>
@@ -46,11 +48,6 @@
#include <vector> #include <vector>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using namespace testing; using namespace testing;
namespace CodeModelBackeEndTest { namespace CodeModelBackeEndTest {

View File

@@ -23,7 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "refactoringclientcallbackmock.h" #include "googletest.h"
#include "mockrefactoringclientcallback.h"
#include <refactoringclient.h> #include <refactoringclient.h>
#include <refactoringcompileroptionsbuilder.h> #include <refactoringcompileroptionsbuilder.h>
@@ -39,11 +40,6 @@
#include <QTextCursor> #include <QTextCursor>
#include <QTextDocument> #include <QTextDocument>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
using ClangRefactoring::RefactoringCompilerOptionsBuilder; using ClangRefactoring::RefactoringCompilerOptionsBuilder;
@@ -59,7 +55,7 @@ class RefactoringClient : public ::testing::Test
void SetUp(); void SetUp();
protected: protected:
RefactoringClientCallBackMock callbackMock; MockRefactoringClientCallBack callbackMock;
ClangRefactoring::RefactoringClient client; ClangRefactoring::RefactoringClient client;
ClangBackEnd::RefactoringConnectionClient connectionClient{&client}; ClangBackEnd::RefactoringConnectionClient connectionClient{&client};
RefactoringEngine engine{connectionClient.serverProxy(), client}; RefactoringEngine engine{connectionClient.serverProxy(), client};

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "mockrefactoringclient.h" #include "mockrefactoringclient.h"
#include "mockrefactoringserver.h" #include "mockrefactoringserver.h"
@@ -38,11 +40,6 @@
#include <vector> #include <vector>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using namespace ClangBackEnd; using namespace ClangBackEnd;
namespace { namespace {

View File

@@ -23,12 +23,9 @@
** **
****************************************************************************/ ****************************************************************************/
#include <refactoringcompilationdatabase.h> #include "googletest.h"
#include <gmock/gmock.h> #include <refactoringcompilationdatabase.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using testing::Contains; using testing::Contains;
using testing::IsEmpty; using testing::IsEmpty;

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "mockrefactoringserver.h" #include "mockrefactoringserver.h"
#include "mockrefactoringclient.h" #include "mockrefactoringclient.h"
@@ -37,11 +39,6 @@
#include <QTextCursor> #include <QTextCursor>
#include <QTextDocument> #include <QTextDocument>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
using testing::_; using testing::_;

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "mockrefactoringclient.h" #include "mockrefactoringclient.h"
#include <refactoringserver.h> #include <refactoringserver.h>
@@ -30,11 +32,6 @@
#include <sourcelocationsforrenamingmessage.h> #include <sourcelocationsforrenamingmessage.h>
#include <sourcelocationscontainer.h> #include <sourcelocationscontainer.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
using testing::AllOf; using testing::AllOf;

View File

@@ -23,12 +23,9 @@
** **
****************************************************************************/ ****************************************************************************/
#include <cpptools/senddocumenttracker.h> #include "googletest.h"
#include <gmock/gmock.h> #include <cpptools/senddocumenttracker.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using CppTools::SendDocumentTracker; using CppTools::SendDocumentTracker;
using testing::PrintToString; using testing::PrintToString;

View File

@@ -23,9 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "gtest/gtest.h" #include "googletest.h"
#include "gmock/gmock-matchers.h"
#include "gtest-qt-printing.h"
#include <utils/sizedarray.h> #include <utils/sizedarray.h>

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <cursor.h> #include <cursor.h>
#include <clangdocument.h> #include <clangdocument.h>
#include <clangdocuments.h> #include <clangdocuments.h>
@@ -39,11 +41,6 @@
#include <QVector> #include <QVector>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::Cursor; using ClangBackEnd::Cursor;
using ClangBackEnd::Document; using ClangBackEnd::Document;
using ClangBackEnd::Documents; using ClangBackEnd::Documents;

View File

@@ -23,9 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "gtest/gtest.h" #include "googletest.h"
#include "gmock/gmock-matchers.h"
#include "gtest-qt-printing.h"
#include <QString> #include <QString>

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <diagnostic.h> #include <diagnostic.h>
#include <diagnosticset.h> #include <diagnosticset.h>
#include <projectpart.h> #include <projectpart.h>
@@ -35,11 +37,6 @@
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::Diagnostic; using ClangBackEnd::Diagnostic;
using ClangBackEnd::DiagnosticSet; using ClangBackEnd::DiagnosticSet;
using ClangBackEnd::ProjectPart; using ClangBackEnd::ProjectPart;

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangtranslationunit.h> #include <clangtranslationunit.h>
#include <diagnostic.h> #include <diagnostic.h>
#include <diagnosticset.h> #include <diagnosticset.h>
@@ -37,11 +39,6 @@
#include <memory> #include <memory>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::DiagnosticSet; using ClangBackEnd::DiagnosticSet;
using ClangBackEnd::Document; using ClangBackEnd::Document;
using ClangBackEnd::Documents; using ClangBackEnd::Documents;

View File

@@ -23,12 +23,9 @@
** **
****************************************************************************/ ****************************************************************************/
#include <sqlitecolumn.h> #include "googletest.h"
#include <gmock/gmock.h> #include <sqlitecolumn.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "spydummy.h" #include "spydummy.h"
#include <sqlitedatabase.h> #include <sqlitedatabase.h>
@@ -32,11 +34,6 @@
#include <QSignalSpy> #include <QSignalSpy>
#include <QVariant> #include <QVariant>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
class SqliteDatabase : public ::testing::Test class SqliteDatabase : public ::testing::Test

View File

@@ -23,17 +23,14 @@
** **
****************************************************************************/ ****************************************************************************/
#include "sqlitedatabasebackend.h" #include "googletest.h"
#include "sqliteexception.h"
#include "sqlitewritestatement.h" #include <sqlitedatabasebackend.h>
#include <sqliteexception.h>
#include <sqlitewritestatement.h>
#include <QDir> #include <QDir>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
class SqliteDatabaseBackend : public ::testing::Test class SqliteDatabaseBackend : public ::testing::Test

View File

@@ -23,6 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <sqlitedatabasebackend.h> #include <sqlitedatabasebackend.h>
#include <sqlitereadstatement.h> #include <sqlitereadstatement.h>
#include <sqlitereadwritestatement.h> #include <sqlitereadwritestatement.h>
@@ -36,11 +38,6 @@
#include <QStringList> #include <QStringList>
#include <QVariant> #include <QVariant>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
class SqliteStatement : public ::testing::Test class SqliteStatement : public ::testing::Test
{ {

View File

@@ -23,6 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include "spydummy.h" #include "spydummy.h"
#include <sqlitecolumn.h> #include <sqlitecolumn.h>
@@ -33,11 +34,6 @@
#include <QSignalSpy> #include <QSignalSpy>
#include <QVariant> #include <QVariant>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace { namespace {
class SqliteTable : public ::testing::Test class SqliteTable : public ::testing::Test

View File

@@ -23,17 +23,14 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <sqlstatementbuilderexception.h> #include <sqlstatementbuilderexception.h>
#include <sqlstatementbuilder.h> #include <sqlstatementbuilder.h>
#include <utf8stringvector.h> #include <utf8stringvector.h>
#include <QString> #include <QString>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using namespace ::testing; using namespace ::testing;
TEST(SqlStatementBuilder, Bind) TEST(SqlStatementBuilder, Bind)

View File

@@ -23,15 +23,12 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangrefactoringbackend_global.h> #include <clangrefactoringbackend_global.h>
#include <symbolfinder.h> #include <symbolfinder.h>
#include "filesystemutilities.h" #include "filesystem-utilities.h"
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::SymbolFinder; using ClangBackEnd::SymbolFinder;
using ClangBackEnd::FileContent; using ClangBackEnd::FileContent;

View File

@@ -23,15 +23,12 @@
** **
****************************************************************************/ ****************************************************************************/
#include "googletest.h"
#include <clangtranslationunitupdater.h> #include <clangtranslationunitupdater.h>
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using ClangBackEnd::TranslationUnitUpdater; using ClangBackEnd::TranslationUnitUpdater;
using ClangBackEnd::TranslationUnitUpdateInput; using ClangBackEnd::TranslationUnitUpdateInput;
using ClangBackEnd::TranslationUnitUpdateResult; using ClangBackEnd::TranslationUnitUpdateResult;

View File

@@ -25,101 +25,102 @@ win32:DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echo)xxx\\\"\"
unix: DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echoserver/echo)xxx\\\"\" unix: DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echoserver/echo)xxx\\\"\"
SOURCES += \ SOURCES += \
clientserverinprocesstest.cpp \ clientserverinprocess-test.cpp \
clientserveroutsideprocess.cpp \ clientserveroutsideprocess.cpp \
lineprefixertest.cpp \ lineprefixer-test.cpp \
main.cpp \ processevents-utilities.cpp \
readandwritemessageblocktest.cpp \ readandwritemessageblock-test.cpp \
sizedarraytest.cpp \ sizedarray-test.cpp \
smallstring-test.cpp \
spydummy.cpp \ spydummy.cpp \
smallstringtest.cpp \ unittests-main.cpp \
testutils.cpp \ utf8-test.cpp
utf8test.cpp
!isEmpty(LIBCLANG_LIBS) { !isEmpty(LIBCLANG_LIBS) {
SOURCES += \ SOURCES += \
activationsequencecontextprocessortest.cpp \ activationsequencecontextprocessor-test.cpp \
activationsequenceprocessortest.cpp \ activationsequenceprocessor-test.cpp \
clangcodecompleteresultstest.cpp \
clangcompletioncontextanalyzertest.cpp \
clangdiagnosticfiltertest.cpp \
clangfixitoperationtest.cpp \
clangipcservertest.cpp \
clangstringtest.cpp \
codecompletionsextractortest.cpp \
codecompletiontest.cpp \
completionchunkstotextconvertertest.cpp \
createtablesqlstatementbuildertest.cpp \
diagnosticsettest.cpp \
diagnostictest.cpp \
fixittest.cpp \
projecttest.cpp \
sourcelocationtest.cpp \
sourcerangetest.cpp \
sqlitecolumntest.cpp \
sqlitedatabasebackendtest.cpp \
sqlitedatabasetest.cpp \
sqlitestatementtest.cpp \
sqlitetabletest.cpp \
sqlstatementbuildertest.cpp \
clangdocumenttest.cpp \
clangdocumentstest.cpp \
unsavedfilestest.cpp \
senddocumenttrackertest.cpp \
cursortest.cpp \
skippedsourcerangestest.cpp \
highlightingmarksreportertest.cpp \
chunksreportedmonitor.cpp \ chunksreportedmonitor.cpp \
unsavedfiletest.cpp \ clangasyncjob-base.cpp \
clangisdiagnosticrelatedtolocationtest.cpp \ clangcodecompleteresults-test.cpp \
highlightingmarkstest.cpp \ clangcompletecodejob-test.cpp \
utf8positionfromlinecolumntest.cpp \ clangcompletioncontextanalyzer-test.cpp \
translationunitupdatertest.cpp \ clangcreateinitialdocumentpreamblejob-test.cpp \
clangasyncjobtest.cpp \ clangdiagnosticfilter-test.cpp \
clangcompletecodejobtest.cpp \ clangdocuments-test.cpp \
clangcreateinitialdocumentpreamblejobtest.cpp \ clangdocument-test.cpp \
clangjobqueuetest.cpp \ clangfixitoperation-test.cpp \
clangjobstest.cpp \ clangipcserver-test.cpp \
clangrequestdocumentannotationsjobtest.cpp \ clangisdiagnosticrelatedtolocation-test.cpp \
clangupdatedocumentannotationsjobtest.cpp clangjobqueue-test.cpp \
clangjobs-test.cpp \
clangrequestdocumentannotationsjob-test.cpp \
clangstring-test.cpp \
clangupdatedocumentannotationsjob-test.cpp \
codecompletionsextractor-test.cpp \
codecompletion-test.cpp \
completionchunkstotextconverter-test.cpp \
createtablesqlstatementbuilder-test.cpp \
cursor-test.cpp \
diagnosticset-test.cpp \
diagnostic-test.cpp \
fixit-test.cpp \
highlightingmarksreporter-test.cpp \
highlightingmarks-test.cpp \
projectpart-test.cpp \
senddocumenttracker-test.cpp \
skippedsourceranges-test.cpp \
sourcelocation-test.cpp \
sourcerange-test.cpp \
sqlitecolumn-test.cpp \
sqlitedatabasebackend-test.cpp \
sqlitedatabase-test.cpp \
sqlitestatement-test.cpp \
sqlitetable-test.cpp \
sqlstatementbuilder-test.cpp \
translationunitupdater-test.cpp \
unsavedfiles-test.cpp \
unsavedfile-test.cpp \
utf8positionfromlinecolumn-test.cpp
} }
!isEmpty(LIBTOOLING_LIBS) { !isEmpty(LIBTOOLING_LIBS) {
SOURCES += \ SOURCES += \
refactoringclientserverinprocesstest.cpp \ refactoringclientserverinprocess-test.cpp \
refactoringcompilationdatabasetest.cpp \ refactoringclient-test.cpp \
refactoringservertest.cpp \ refactoringcompilationdatabase-test.cpp \
refactoringenginetest.cpp \ refactoringengine-test.cpp \
refactoringclienttest.cpp \ refactoringserver-test.cpp \
symbolfindertest.cpp symbolfinder-test.cpp
} }
exists($$GOOGLEBENCHMARK_DIR) { exists($$GOOGLEBENCHMARK_DIR) {
SOURCES += \ SOURCES += \
smallstringbenchmark.cpp smallstring-benchmark.cpp
} }
HEADERS += \ HEADERS += \
filesystem-utilities.h \
googletest.h \
gtest-qt-printing.h \ gtest-qt-printing.h \
spydummy.h \ processevents-utilities.h \
dummyclangipcclient.h \ spydummy.h
testutils.h \
mockclangcodemodelclient.h \
mockclangcodemodelserver.h \
mockrefactoringclient.h \
mockrefactoringserver.h \
refactoringclientcallbackmock.h
!isEmpty(LIBCLANG_LIBS) { !isEmpty(LIBCLANG_LIBS) {
HEADERS += \ HEADERS += \
clangasyncjobtest.h \
chunksreportedmonitor.h \ chunksreportedmonitor.h \
matcher-diagnosticcontainer.h clangasyncjob-base.h \
diagnosticcontainer-matcher.h \
dummyclangipcclient.h \
mockclangcodemodelclient.h \
mockclangcodemodelserver.h
} }
!isEmpty(LIBTOOLING_LIBS) { !isEmpty(LIBTOOLING_LIBS) {
HEADERS += \ HEADERS += \
filesystemutilities.h mockrefactoringclientcallback.h \
mockrefactoringclient.h \
mockrefactoringserver.h
} }
OTHER_FILES += $$files(data/*) OTHER_FILES += $$files(data/*)

View File

@@ -23,10 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "gtest/gtest.h" #include "googletest.h"
#include "gmock/gmock-matchers.h"
#include "gmock/gmock.h"
#include "gtest-qt-printing.h"
#include <clangfilepath.h> #include <clangfilepath.h>
#include <unsavedfile.h> #include <unsavedfile.h>

View File

@@ -23,10 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "gtest/gtest.h" #include "googletest.h"
#include "gmock/gmock-matchers.h"
#include "gmock/gmock.h"
#include "gtest-qt-printing.h"
#include <filecontainer.h> #include <filecontainer.h>
#include <unsavedfiles.h> #include <unsavedfiles.h>

View File

@@ -23,9 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "gtest/gtest.h" #include "googletest.h"
#include "gmock/gmock-matchers.h"
#include "gtest-qt-printing.h"
#include <QString> #include <QString>

View File

@@ -23,10 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "gtest/gtest.h" #include "googletest.h"
#include "gmock/gmock-matchers.h"
#include "gmock/gmock.h"
#include "gtest-qt-printing.h"
#include <utf8positionfromlinecolumn.h> #include <utf8positionfromlinecolumn.h>
#include <utf8string.h> #include <utf8string.h>