From 7b1254b00997b07aaf4daff35934c7c4c43971ca Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 7 Sep 2021 13:44:29 +0200 Subject: Tidy up in counting, skip and skipinit selftests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø Reviewed-by: Ievgenii Meshcheriakov --- tests/auto/testlib/selftests/counting/tst_counting.cpp | 9 ++++++--- tests/auto/testlib/selftests/skip/tst_skip.cpp | 6 +++--- tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'tests/auto/testlib') 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) -- cgit v1.2.3