summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-09-07 13:44:29 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-09-09 20:42:35 +0200
commit7b1254b00997b07aaf4daff35934c7c4c43971ca (patch)
tree1cf293300692201234207c737e3f9aada61adfb7 /tests
parent16b11bb81eb02f182e3570c9241f57c5689fb90e (diff)
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/testlib/selftests/counting/tst_counting.cpp9
-rw-r--r--tests/auto/testlib/selftests/skip/tst_skip.cpp6
-rw-r--r--tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp4
3 files changed, 11 insertions, 8 deletions
diff --git a/tests/auto/testlib/selftests/counting/tst_counting.cpp b/tests/auto/testlib/selftests/counting/tst_counting.cpp
index ed48c88283..0831f88005 100644
--- a/tests/auto/testlib/selftests/counting/tst_counting.cpp
+++ b/tests/auto/testlib/selftests/counting/tst_counting.cpp
@@ -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()
diff --git a/tests/auto/testlib/selftests/skip/tst_skip.cpp b/tests/auto/testlib/selftests/skip/tst_skip.cpp
index 66a919f209..43ef8155e0 100644
--- a/tests/auto/testlib/selftests/skip/tst_skip.cpp
+++ b/tests/auto/testlib/selftests/skip/tst_skip.cpp
@@ -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()
diff --git a/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp b/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp
index 8fe8e8668f..832792800c 100644
--- a/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp
+++ b/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp
@@ -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)