diff options
Diffstat (limited to 'tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp')
-rw-r--r-- | tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp b/tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp index 1d2658c38f..0101c74a7b 100644 --- a/tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp +++ b/tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QStringTokenizer> #include <QStringBuilder> @@ -34,7 +9,7 @@ #include <string> Q_DECLARE_METATYPE(Qt::SplitBehavior) - +namespace { class tst_QStringTokenizer : public QObject { Q_OBJECT @@ -70,6 +45,7 @@ QStringList toQStringList(const Container &c) r.push_back(toQString(e)); return r; } +} // namespace void tst_QStringTokenizer::constExpr() const { @@ -145,6 +121,19 @@ void tst_QStringTokenizer::toContainer() const auto v = tok.toContainer(); QVERIFY((std::is_same_v<decltype(v), QList<QLatin1String>>)); } + // QLatin1String value_type into QStringList + { + auto tok = qTokenize(QLatin1String{"a,b,c"}, u','); + QStringList result; + tok.toContainer(result); + QCOMPARE(result, QStringList({"a", "b", "c"})); + } + // QLatin1String value_type into QStringList: rvalue overload + { + QStringList result; + qTokenize(QLatin1String{"a,b,c"}, u',').toContainer(result); + QCOMPARE(result, QStringList({"a", "b", "c"})); + } } QTEST_APPLESS_MAIN(tst_QStringTokenizer) |