summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolstestcase.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2013-12-30 19:44:42 +0100
committerNikolai Kosjar <nikolai.kosjar@digia.com>2014-01-07 14:19:33 +0100
commit0bd59178679ea1f573b484e5f2baf178352c44ef (patch)
tree5d4a19d2556c9d41bc2a1d4f42510c92a5107d66 /src/plugins/cpptools/cpptoolstestcase.cpp
parentc7f3ac407394d3c4d7fe817a6a913cd3256c37e5 (diff)
downloadqt-creator-0bd59178679ea1f573b484e5f2baf178352c44ef.tar.gz
CppEditor/CppTools: Don't continue in test function on failure
QVERIFY/QCOMPARE are meant to be called in the test function so that on failure they just can "return" and thus skip subsequent code. Since we use reusable test code in the test functions (the *TestCase classes), we need to ensure that on failure no further test code is executed. This mostly inlines the run function of the test classes into the constructor. Change-Id: I320ee032bdde0174ddfe3fdf3f9e18e19abf1d7f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cpptoolstestcase.cpp')
-rw-r--r--src/plugins/cpptools/cpptoolstestcase.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp
index be9e61fb03..80de9dfc1d 100644
--- a/src/plugins/cpptools/cpptoolstestcase.cpp
+++ b/src/plugins/cpptools/cpptoolstestcase.cpp
@@ -70,10 +70,12 @@ bool TestDocument::writeToDisk() const
TestCase::TestCase(bool runGarbageCollector)
: m_modelManager(CppModelManagerInterface::instance())
+ , m_succeededSoFar(false)
, m_runGarbageCollector(runGarbageCollector)
{
if (m_runGarbageCollector)
QVERIFY(garbageCollectGlobalSnapshot());
+ m_succeededSoFar = true;
}
TestCase::~TestCase()
@@ -85,6 +87,11 @@ TestCase::~TestCase()
QVERIFY(garbageCollectGlobalSnapshot());
}
+bool TestCase::succeededSoFar() const
+{
+ return m_succeededSoFar;
+}
+
CPlusPlus::Snapshot TestCase::globalSnapshot()
{
return CppModelManagerInterface::instance()->snapshot();