forked from qt-creator/qt-creator
UnitTests: Cleanup unit tests
There was still unneeded PrintTo functions and gtest includes. It is now possible to use MockFunction for callbacks. Change-Id: Ie5875c3697069a37b48c2f2022f1f8c21f1c794f Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -31,10 +31,6 @@
|
||||
|
||||
#include <utils/smallstringfwd.h>
|
||||
|
||||
#ifdef UNIT_TESTS
|
||||
#include <gtest/gtest.h>
|
||||
#endif
|
||||
|
||||
#if defined(CLANGSUPPORT_BUILD_LIB)
|
||||
# define CLANGSUPPORT_EXPORT Q_DECL_EXPORT
|
||||
#elif defined(CLANGSUPPORT_BUILD_STATIC_LIB)
|
||||
|
||||
@@ -39,11 +39,6 @@ QDebug operator<<(QDebug debug, const Utf8String &text)
|
||||
return debug;
|
||||
}
|
||||
|
||||
void PrintTo(const Utf8String &text, ::std::ostream* os)
|
||||
{
|
||||
*os << "\"" << text.toByteArray().data() << "\"";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream &os, const Utf8String &utf8String)
|
||||
{
|
||||
using std::ostream;
|
||||
|
||||
@@ -266,7 +266,6 @@ private:
|
||||
};
|
||||
|
||||
SQLITE_EXPORT QDebug operator<<(QDebug debug, const Utf8String &text);
|
||||
SQLITE_EXPORT void PrintTo(const Utf8String &text, ::std::ostream* os);
|
||||
SQLITE_EXPORT std::ostream& operator<<(std::ostream &os, const Utf8String &utf8String);
|
||||
|
||||
#define Utf8StringLiteral(str) Utf8String::fromByteArray(QByteArrayLiteral(str))
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
|
||||
#ifdef UNIT_TESTS
|
||||
#include <gtest/gtest.h>
|
||||
#endif
|
||||
|
||||
namespace Utils {
|
||||
|
||||
template <uint Size>
|
||||
@@ -235,22 +231,6 @@ QDataStream &operator>>(QDataStream &in, vector<Type> &vector)
|
||||
return in;
|
||||
}
|
||||
|
||||
#ifdef UNIT_TESTS
|
||||
template <typename T>
|
||||
ostream &operator<<(ostream &out, const vector<T> &vector)
|
||||
{
|
||||
out << "[";
|
||||
|
||||
ostream_iterator<string> outIterator(out, ", ");
|
||||
|
||||
for (const auto &entry : vector)
|
||||
outIterator = ::testing::PrintToString(entry);
|
||||
|
||||
out << "]";
|
||||
|
||||
return out;
|
||||
}
|
||||
#else
|
||||
template <typename T>
|
||||
ostream &operator<<(ostream &out, const vector<T> &vector)
|
||||
{
|
||||
@@ -262,7 +242,6 @@ ostream &operator<<(ostream &out, const vector<T> &vector)
|
||||
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "googletest.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QSharedPointer>
|
||||
#include <QTextBlock>
|
||||
@@ -35,11 +37,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "gmock/gmock-matchers.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest-qt-printing.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -33,7 +33,19 @@ requires(exists($$GTEST_SRC_DIR):exists($$GMOCK_SRC_DIR))
|
||||
|
||||
DEFINES += \
|
||||
GTEST_HAS_STD_INITIALIZER_LIST_ \
|
||||
GTEST_LANG_CXX11
|
||||
GTEST_LANG_CXX11 \
|
||||
GTEST_HAS_STD_TUPLE_ \
|
||||
GTEST_HAS_STD_TYPE_TRAITS_ \
|
||||
GTEST_HAS_STD_FUNCTION_ \
|
||||
GTEST_HAS_RTTI \
|
||||
GTEST_HAS_STD_BEGIN_AND_END_ \
|
||||
GTEST_HAS_STD_UNIQUE_PTR_ \
|
||||
GTEST_HAS_EXCEPTIONS \
|
||||
GTEST_HAS_STREAM_REDIRECTION \
|
||||
GTEST_HAS_TYPED_TEST \
|
||||
GTEST_HAS_TYPED_TEST_P \
|
||||
GTEST_HAS_PARAM_TEST \
|
||||
GTEST_HAS_DEATH_TEST
|
||||
|
||||
INCLUDEPATH *= \
|
||||
$$GTEST_INCLUDE_DIR \
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <gmock/gmock.h>
|
||||
#include <gmock/gmock-matchers.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <gtest/gtest-printers.h>
|
||||
#include "compare-operators.h"
|
||||
|
||||
#include "conditionally-disabled-tests.h"
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <sourcelocationentry.h>
|
||||
#include <sourcelocationscontainer.h>
|
||||
#include <tokeninfos.h>
|
||||
#include <filepathview.h>
|
||||
|
||||
#include <cpptools/usages.h>
|
||||
|
||||
@@ -121,6 +122,16 @@ std::ostream &operator<<(std::ostream &out, const FilePathId &id)
|
||||
return out << "(" << id.directoryId << ", " << id.fileNameId << ")";
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const FilePathView &filePathView)
|
||||
{
|
||||
return out << "(" << filePathView.toStringView() << ", " << filePathView.slashIndex() << ")";
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const NativeFilePathView &nativeFilePathView)
|
||||
{
|
||||
return out << "(" << nativeFilePathView.toStringView() << ", " << nativeFilePathView.slashIndex() << ")";
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const IdPaths &idPaths)
|
||||
{
|
||||
out << "("
|
||||
@@ -720,16 +731,6 @@ std::ostream &operator<<(std::ostream &out, const FilePath &filePath)
|
||||
return out << "(" << filePath.path() << ", " << filePath.slashIndex() << ")";
|
||||
}
|
||||
|
||||
void PrintTo(const FilePathId &id, ::std::ostream *os)
|
||||
{
|
||||
*os << id;
|
||||
}
|
||||
|
||||
void PrintTo(const FilePath &filePath, ::std::ostream *os)
|
||||
{
|
||||
*os << filePath;
|
||||
}
|
||||
|
||||
namespace V2 {
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const FileContainer &container)
|
||||
|
||||
@@ -114,11 +114,14 @@ class UpdateVisibleTranslationUnitsMessage;
|
||||
class FilePath;
|
||||
class TokenInfo;
|
||||
class TokenInfos;
|
||||
template <char WindowsSlash>
|
||||
class AbstractFilePathView;
|
||||
using FilePathView = AbstractFilePathView<'/'>;
|
||||
using NativeFilePathView = AbstractFilePathView<'\\'>;
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const SourceLocationEntry &entry);
|
||||
std::ostream &operator<<(std::ostream &out, const IdPaths &idPaths);
|
||||
std::ostream &operator<<(std::ostream &out, const WatcherEntry &entry);
|
||||
std::ostream &operator<<(std::ostream &out, const FilePath &filePath);
|
||||
std::ostream &operator<<(std::ostream &out, const SourceLocationsContainer &container);
|
||||
std::ostream &operator<<(std::ostream &out, const RegisterProjectPartsForEditorMessage &message);
|
||||
std::ostream &operator<<(std::ostream &out, const CancelMessage &message);
|
||||
@@ -168,8 +171,11 @@ std::ostream &operator<<(std::ostream &out, const UpdatePchProjectPartsMessage &
|
||||
std::ostream &operator<<(std::ostream &out, const UpdateTranslationUnitsForEditorMessage &message);
|
||||
std::ostream &operator<<(std::ostream &out, const UpdateVisibleTranslationUnitsMessage &message);
|
||||
std::ostream &operator<<(std::ostream &out, const FilePath &filePath);
|
||||
std::ostream &operator<<(std::ostream &out, const FilePathId &filePathId);
|
||||
std::ostream &operator<<(std::ostream &out, const TokenInfo& tokenInfo);
|
||||
std::ostream &operator<<(std::ostream &out, const TokenInfos &tokenInfos);
|
||||
std::ostream &operator<<(std::ostream &out, const FilePathView &filePathView);
|
||||
std::ostream &operator<<(std::ostream &out, const NativeFilePathView &nativeFilePathView);
|
||||
|
||||
namespace V2 {
|
||||
class FileContainer;
|
||||
@@ -183,8 +189,6 @@ std::ostream &operator<<(std::ostream &out, const SourceLocationContainer &conta
|
||||
std::ostream &operator<<(std::ostream &out, const SourceRangeContainer &container);
|
||||
} // namespace V2
|
||||
|
||||
void PrintTo(const FilePathId &id, ::std::ostream *os);
|
||||
void PrintTo(const FilePath &filePath, ::std::ostream *os);
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
namespace ClangRefactoring {
|
||||
|
||||
Reference in New Issue
Block a user