qt5base-lts/tests/auto/testlib/selftests/failcleanuptestcase/tst_failcleanuptestcase.cpp
Edward Welbourne 21e9c223b7 Test skip and fail in cleanup() as well as in cleanupTestCase()
The skipcleanup and failcleanup tests were actually testing skip and
fail in cleanupTestCase(), not in cleanup(). Add almost-duplicate
tests and clean up so that we now have {fail,skip}cleanup(,testcase}
tests to cover all four cases. Generated expected output. The new
tests (with old names) get their fail or skip - during cleanup() -
reported against the test instead of the cleanupTestCase function.
(Results for {init,cleanup}TestCase() are always reported, even when
these slots are not defined, as no-op passes.)

Pick-to: 6.4
Change-Id: I0988d1696b50c0e2f30c45ddc25e1bd0bfd2151a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-07-25 19:29:07 +02:00

26 lines
568 B
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
class tst_FailCleanupTestCase: public QObject
{
Q_OBJECT
private slots:
void aTestFunction() const;
void cleanupTestCase() const;
};
void tst_FailCleanupTestCase::aTestFunction() const
{
QVERIFY(true);
}
void tst_FailCleanupTestCase::cleanupTestCase() const
{
QVERIFY2(false, "Fail inside cleanupTestCase");
}
QTEST_APPLESS_MAIN(tst_FailCleanupTestCase)
#include "tst_failcleanuptestcase.moc"