Tidy up in counting, skip and skipinit selftests

Minor clean-up.
Split two long lines and added braces, called for by Qt coding style.
Turned some QDebug("this line should never be reached...") into QFAIL();
that should make the effor a bit more prominent if it ever happens.
Likewise for a qDebug() << "ERROR: ..." for code not meant to run.

Change-Id: I1d34fe202f269eb3ad8f58feaabed809e4fec99c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
This commit is contained in:
Edward Welbourne 2021-09-07 13:44:29 +02:00
parent 16b11bb81e
commit 7b1254b009
3 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -217,10 +217,13 @@ void tst_Counting::testFailFail()
void tst_Counting::init()
{
if (strcmp(QTest::currentTestFunction(), "testFailInInit") == 0 && strcmp(QTest::currentDataTag(), "fail") == 0)
if (strcmp(QTest::currentTestFunction(), "testFailInInit") == 0
&& strcmp(QTest::currentDataTag(), "fail") == 0) {
QFAIL("Fail in init()");
else if (strcmp(QTest::currentTestFunction(), "testSkipInInit") == 0 && strcmp(QTest::currentDataTag(), "skip") == 0)
} else if (strcmp(QTest::currentTestFunction(), "testSkipInInit") == 0
&& strcmp(QTest::currentDataTag(), "skip") == 0) {
QSKIP("Skip in init()");
}
}
void tst_Counting::cleanup()

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -57,7 +57,7 @@ void tst_Skip::test_data()
void tst_Skip::test()
{
qDebug("this line should never be reached, since we skip in the _data function");
QFAIL("this line should never be reached, since we skip in the _data function");
}
void tst_Skip::emptytest_data()
@ -67,7 +67,7 @@ void tst_Skip::emptytest_data()
void tst_Skip::emptytest()
{
qDebug("this line should never be reached, since we skip in the _data function");
QFAIL("this line should never be reached, since we skip in the _data function");
}
void tst_Skip::singleSkip_data()

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -47,7 +47,7 @@ void tst_SkipInit::initTestCase() const
*/
void tst_SkipInit::aTestFunction() const
{
qDebug() << "ERROR: This function is NOT supposed to be run.";
QFAIL("ERROR: This function is NOT supposed to be run.");
}
QTEST_APPLESS_MAIN(tst_SkipInit)