diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-03-01 17:02:31 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-03-07 05:48:39 +0000 |
commit | 2e1233d3ecd2dcc6c33a7a175e90f778f1b736d8 (patch) | |
tree | b4ca411eb9021134517bfae6d0a336a98b0a5e40 | |
parent | 908b5ebdc9601f16716cc36de8075cce7fa50735 (diff) | |
download | qtbase-2e1233d3ecd2dcc6c33a7a175e90f778f1b736d8.tar.gz |
Doc: fix link to QTest::failOnWarning
Also fix incorrect failOnWarning*s* elsewhere in comments.
Change-Id: I0bbc5e71060348153876f3d9a7c77c67f3c2e00d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 9e31631557ea3f99506377ff91a1e15e942f9e88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/testlib/doc/src/qttest-best-practices.qdoc | 6 | ||||
-rw-r--r-- | src/testlib/qtestlog.cpp | 2 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/warnings/tst_warnings.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/testlib/doc/src/qttest-best-practices.qdoc b/src/testlib/doc/src/qttest-best-practices.qdoc index 4220312149..54a51f4ace 100644 --- a/src/testlib/doc/src/qttest-best-practices.qdoc +++ b/src/testlib/doc/src/qttest-best-practices.qdoc @@ -383,12 +383,12 @@ only tell you whether \e{the test} was built in debug mode, and that does not guarantee that the \e{Qt libraries} were also built in debug mode. - Your tests can (since Qt 6.3) verify that they do not trigger calls to \l - qWarning() by calling \l QTest::failOnWarnings(). This takes the warning + Your tests can (since Qt 6.3) verify that they do not trigger calls to + \l qWarning() by calling \l QTest::failOnWarning(). This takes the warning message to test for or a \l QRegularExpression to match against warnings; if a matching warning is produced, it will be reported and cause the test to fail. For example, a test that should produce no warnings at all can - \c{QTest::failOnWarnings(QRegularExpression(u".*"_s))}, which will match any + \c{QTest::failOnWarning(QRegularExpression(u".*"_s))}, which will match any warning at all. You can also set the environment variable \c QT_FATAL_WARNINGS to cause diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index dca4bc1c10..e01da37911 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -179,7 +179,7 @@ namespace QTest { static bool handleFailOnWarning(const QMessageLogContext &context, const QString &message) { - // failOnWarnings can be called multiple times per test function, so let + // failOnWarning can be called multiple times per test function, so let // each call cause a failure if required. for (const auto &pattern : failOnWarningList) { if (pattern.metaType() == QMetaType::fromType<QString>()) { diff --git a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp index 587d81c325..c113fdaf25 100644 --- a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp +++ b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp @@ -115,7 +115,7 @@ void tst_Warnings::testMissingWarningsWithData() void tst_Warnings::testFailOnWarnings() { - // failOnWarnings() wasn't called yet; shouldn't fail; + // failOnWarning() wasn't called yet; shouldn't fail; qWarning("Ran out of space!"); #if QT_CONFIG(regularexpression) |