qt6windows7/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp
2023-10-29 23:33:08 +01:00

32 lines
632 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_Exception: public QObject
{
Q_OBJECT
private slots:
void throwException() const;
};
/*!
\internal
We simply throw an exception to check that we get sane output/reporting.
*/
void tst_Exception::throwException() const
{
/* When exceptions are disabled, some compilers, at least linux-g++, treat
* exception clauses as hard errors. */
#ifndef QT_NO_EXCEPTIONS
throw 3;
#endif
}
QTEST_MAIN(tst_Exception)
#include "tst_exceptionthrow.moc"