Commit 47c01dae authored by Marco Bubke's avatar Marco Bubke

UnitTest: Cleanup

Improve naming and introduce googletest.h.

Change-Id: I445c13db4c23d6dd5682ce0db3b83055cc6b8a89
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent f717064a
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangactivationsequencecontextprocessor.h>
#include <clangcodemodel/clangcompletionassistinterface.h>
......@@ -32,11 +34,6 @@
#include <QTextCursor>
#include <QTextDocument>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace {
using ContextProcessor = ClangCodeModel::Internal::ActivationSequenceContextProcessor;
......
......@@ -23,15 +23,12 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangactivationsequenceprocessor.h>
#include <cplusplus/Token.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace {
using testing::PrintToString;
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include "chunksreportedmonitor.h"
#include <QSignalSpy>
......@@ -43,10 +45,8 @@ bool ChunksReportedMonitor::waitUntilFinished(int 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;
}
......
......@@ -23,8 +23,8 @@
**
****************************************************************************/
#include "clangasyncjobtest.h"
#include "testutils.h"
#include "clangasyncjob-base.h"
#include "processevents-utilities.h"
#include <clangbackendipc/filecontainer.h>
......@@ -66,5 +66,5 @@ bool ClangAsyncJobTest::waitUntilJobFinished(const ClangBackEnd::IAsyncJob &asyn
{
const auto isOnFinishedSlotExecuted = [&asyncJob](){ return asyncJob.isFinished(); };
return TestUtils::processEventsUntilTrue(isOnFinishedSlotExecuted, timeOutInMs);
return ProcessEventUtilities::processEventsUntilTrue(isOnFinishedSlotExecuted, timeOutInMs);
}
......@@ -25,21 +25,18 @@
#pragma once
#include "googletest.h"
#include "dummyclangipcclient.h"
#include "mockclangcodemodelclient.h"
#include "clangiasyncjob.h"
#include <clangdocument.h>
#include <clangiasyncjob.h>
#include <clangjobrequest.h>
#include <projects.h>
#include <clangdocuments.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
{
protected:
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangcodecompleteresults.h>
#include <clangdocument.h>
#include <clangfilepath.h>
......@@ -36,11 +38,6 @@
#include <clang-c/Index.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace {
using ClangBackEnd::ClangCodeCompleteResults;
......
......@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "clangasyncjobtest.h"
#include "clangasyncjob-base.h"
#include <clangcompletecodejob.h>
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangcodemodel/clangcompletioncontextanalyzer.h>
#include <clangcodemodel/clangcompletionassistinterface.h>
......@@ -30,11 +32,6 @@
#include <QTextDocument>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace ClangCodeModel {
namespace Internal {
......
......@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "clangasyncjobtest.h"
#include "clangasyncjob-base.h"
#include <clangcreateinitialdocumentpreamblejob.h>
......
......@@ -23,15 +23,12 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangdiagnosticfilter.h>
#include <diagnosticcontainer.h>
#include <fixitcontainer.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace {
using ::testing::Contains;
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangfilepath.h>
#include <clangtranslationunitupdater.h>
#include <commandlinearguments.h>
......@@ -41,11 +43,6 @@
#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 <chrono>
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <projectpart.h>
#include <clangexceptions.h>
#include <projects.h>
......@@ -33,11 +35,6 @@
#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::UnsavedFiles;
using ClangBackEnd::ProjectPart;
......
......@@ -23,10 +23,7 @@
**
****************************************************************************/
#include "gtest/gtest.h"
#include "gmock/gmock-matchers.h"
#include "gmock/gmock.h"
#include "gtest-qt-printing.h"
#include "googletest.h"
#include <clangfixitoperation.h>
#include <fixitcontainer.h>
......
......@@ -23,8 +23,10 @@
**
****************************************************************************/
#include "googletest.h"
#include "mockclangcodemodelclient.h"
#include "testutils.h"
#include "processevents-utilities.h"
#include <clangcodemodelserver.h>
#include <highlightingmarkcontainer.h>
......@@ -41,11 +43,6 @@
#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::Contains;
using testing::Not;
......@@ -331,7 +328,7 @@ bool ClangClangCodeModelServer::waitUntilAllJobsFinished(int timeOutInMs)
&& !clangServer.isTimerRunningForTestOnly();
};
return TestUtils::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs);
return ProcessEventUtilities::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs);
}
void ClangClangCodeModelServer::registerProjectAndFilesAndWaitForFinished(
......
......@@ -23,14 +23,11 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangisdiagnosticrelatedtolocation.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::SourceLocationContainer;
using ClangBackEnd::SourceRangeContainer;
......
......@@ -23,7 +23,8 @@
**
****************************************************************************/
#include "testutils.h"
#include "googletest.h"
#include "processevents-utilities.h"
#include <clangdocument.h>
#include <clangdocuments.h>
......@@ -35,11 +36,6 @@
#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>
using namespace ClangBackEnd;
......
......@@ -23,7 +23,8 @@
**
****************************************************************************/
#include "testutils.h"
#include "googletest.h"
#include "processevents-utilities.h"
#include "dummyclangipcclient.h"
#include <clangdocument.h>
......@@ -36,11 +37,6 @@
#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 testing::IsNull;
......@@ -136,7 +132,7 @@ bool Jobs::waitUntilAllJobsFinished(int timeOutInMs) const
{
const auto noJobsRunningAnymore = [this](){ return jobs.runningJobs() == 0; };
return TestUtils::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs);
return ProcessEventUtilities::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs);
}
bool Jobs::waitUntilJobChainFinished(int timeOutInMs) const
......@@ -145,7 +141,7 @@ bool Jobs::waitUntilJobChainFinished(int timeOutInMs) const
return jobs.runningJobs() == 0 && jobs.queue().isEmpty();
};
return TestUtils::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs);
return ProcessEventUtilities::processEventsUntilTrue(noJobsRunningAnymore, timeOutInMs);
}
JobRequest Jobs::createJobRequest(const Utf8String &filePath,
......
......@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "clangasyncjobtest.h"
#include "clangasyncjob-base.h"
#include <clangrequestdocumentannotationsjob.h>
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangstring.h>
#include <utf8string.h>
......@@ -30,11 +32,6 @@
#include <clang-c/CXString.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 {
using ::testing::StrEq;
......
......@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "clangasyncjobtest.h"
#include "clangasyncjob-base.h"
#include <clangupdatedocumentannotationsjob.h>
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include "mockclangcodemodelclient.h"
#include "mockclangcodemodelserver.h"
......@@ -55,11 +57,6 @@
#include <vector>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using namespace ClangBackEnd;
namespace {
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include "mockclangcodemodelclient.h"
#include <cmbalivemessage.h>
......@@ -41,11 +43,6 @@
#include <translationunitdoesnotexistmessage.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 <QBuffer>
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <codecompleter.h>
#include <clangdocument.h>
#include <filecontainer.h>
......@@ -36,11 +38,6 @@
#include <QFile>
#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::Contains;
using ::testing::AllOf;
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangcodecompleteresults.h>
#include <clangdocument.h>
#include <clangfilepath.h>
......@@ -40,11 +42,6 @@
#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::ClangCodeCompleteResults;
using ClangBackEnd::FilePath;
......
......@@ -23,14 +23,11 @@
**
****************************************************************************/
#include "googletest.h"
#include <codecompletionchunk.h>
#include <clangcompletionchunkstotextconverter.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace {
using ClangBackEnd::CodeCompletionChunk;
......
......@@ -23,9 +23,7 @@
**
****************************************************************************/
#include "gtest/gtest.h"
#include "gmock/gmock-matchers.h"
#include "gtest-qt-printing.h"
#include "googletest.h"
#include <QString>
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangdocument.h>
#include <clangdocuments.h>
#include <clangstring.h>
......@@ -34,11 +36,6 @@
#include <clangtranslationunit.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::Document;
using ClangBackEnd::TranslationUnit;
......
......@@ -23,6 +23,9 @@
**
****************************************************************************/
#include "googletest.h"
#include "diagnosticcontainer-matcher.h"
#include <diagnostic.h>
#include <diagnosticcontainer.h>
#include <diagnosticset.h>
......@@ -38,12 +41,6 @@
#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::Not;
......
......@@ -23,6 +23,9 @@
**
****************************************************************************/
#include "googletest.h"
#include "diagnosticcontainer-matcher.h"
#include <clangbackendipc_global.h>
#include <clangdocument.h>
#include <diagnosticcontainer.h>
......@@ -39,12 +42,6 @@
#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::Not;
using ::testing::PrintToString;
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <diagnostic.h>
#include <diagnosticset.h>
#include <projectpart.h>
......@@ -37,11 +39,6 @@
#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::Document;
using ClangBackEnd::TranslationUnit;
......
/****************************************************************************
**
** 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"
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <clangdocument.h>
#include <clangdocuments.h>
#include <clangtranslationunit.h>
......@@ -39,11 +41,6 @@
#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::HighlightingTypes;
using ClangBackEnd::HighlightingMark;
......
......@@ -23,6 +23,8 @@
**
****************************************************************************/
#include "googletest.h"
#include <chunksreportedmonitor.h>
#include <clangdocument.h>
#include <clangdocuments.h>
......@@ -34,11 +36,6 @@
#include <projects.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::HighlightingMarks;
using ClangBackEnd::HighlightingMarkContainer;
......
......@@ -23,13 +23,11 @@
**
****************************************************************************/
#include "googletest.h"
#include <lineprefixer.h>
#include <utf8string.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
namespace {
QByteArray runPrefixer(QList<QByteArray> inputChunks);
......
......@@ -32,7 +32,7 @@
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
class RefactoringClientCallBackMock
class MockRefactoringClientCallBack
{
public:
MOCK_METHOD3(localRenaming,
......
......@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "testutils.h"
#include "processevents-utilities.h"