Commit f07bc467 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Clang: Tests: Improve DocumentSuspenderResumer

* Use IsEmpty()
* Set up proper error printer

Change-Id: I9d4750f8e69e0660ece33015d439c796077d1727
Reviewed-by: Marco Bubke's avatarMarco Bubke <marco.bubke@qt.io>
parent 04da8812
......@@ -68,6 +68,16 @@ QDebug operator<<(QDebug debug, JobRequest::Type type)
return debug;
}
std::ostream &operator<<(std::ostream &os, JobRequest::Type type)
{
return os << JobRequestTypeToText(type);
}
std::ostream &operator<<(std::ostream &os, PreferredTranslationUnit preferredTranslationUnit)
{
return os << preferredTranslationUnitToText(preferredTranslationUnit);
}
QDebug operator<<(QDebug debug, const JobRequest &jobRequest)
{
debug.nospace() << "Job<"
......
......@@ -114,5 +114,8 @@ public:
using JobRequests = QVector<JobRequest>;
QDebug operator<<(QDebug debug, const JobRequest &jobRequest);
std::ostream &operator<<(std::ostream &os, JobRequest::Type type);
std::ostream &operator<<(std::ostream &os, PreferredTranslationUnit preferredTranslationUnit);
} // namespace ClangBackEnd
......@@ -62,6 +62,17 @@ bool operator==(const SuspendResumeJobsEntry &a, const SuspendResumeJobsEntry &b
&& a.preferredTranslationUnit == b.preferredTranslationUnit;
}
std::ostream &operator<<(std::ostream &os, const SuspendResumeJobsEntry &entry)
{
os << "SuspendResumeJobsEntry("
<< entry.document.filePath() << ", "
<< entry.jobRequestType << ", "
<< entry.preferredTranslationUnit
<< ")";
return os;
}
} // ClangBackEnd
namespace {
......@@ -196,7 +207,7 @@ TEST_F(DocumentSuspenderResumer, DoNotCreateSuspendJobForVisible)
const SuspendResumeJobs jobs = createSuspendResumeJobs(/*hotDocumentsSize=*/ 0);
ASSERT_THAT(jobs, ContainerEq(SuspendResumeJobs()));
ASSERT_THAT(jobs, IsEmpty());
}
TEST_F(DocumentSuspenderResumer, DoNotCreateSuspendJobForUnparsed)
......@@ -207,7 +218,7 @@ TEST_F(DocumentSuspenderResumer, DoNotCreateSuspendJobForUnparsed)
const SuspendResumeJobs jobs = createSuspendResumeJobs(/*hotDocumentsSize=*/ 0);
ASSERT_THAT(jobs, ContainerEq(SuspendResumeJobs()));
ASSERT_THAT(jobs, IsEmpty());
}
TEST_F(DocumentSuspenderResumer, CreateSuspendJobsForDocumentWithSupportiveTranslationUnit)
......@@ -249,7 +260,7 @@ TEST_F(DocumentSuspenderResumer, DoNotCreateResumeJobForInvisible)
const SuspendResumeJobs jobs = createSuspendResumeJobs(/*hotDocumentsSize=*/ 0);
ASSERT_THAT(jobs, ContainerEq(SuspendResumeJobs()));
ASSERT_THAT(jobs, IsEmpty());
}
TEST_F(DocumentSuspenderResumer, CreateResumeJobsForDocumentWithSupportiveTranslationUnit)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment