diff options
Diffstat (limited to 'sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp')
-rw-r--r-- | sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp | 113 |
1 files changed, 47 insertions, 66 deletions
diff --git a/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp b/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp index 9824d1bf0..17a069b5e 100644 --- a/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp @@ -1,63 +1,44 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of Qt for Python. -** -** $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) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "testremoveoperatormethod.h" -#include <QtTest/QTest> #include "testutil.h" #include <abstractmetafunction.h> #include <abstractmetalang.h> #include <typesystem.h> +#include <qtcompat.h> + +#include <QtTest/QTest> + +using namespace Qt::StringLiterals; + void TestRemoveOperatorMethod::testRemoveOperatorMethod() { - const char* cppCode ="\ - #include <stdint.h>\n\ - \n\ - struct Char {};\n\ - struct ByteArray {};\n\ - struct String {};\n\ - \n\ - struct A {\n\ - A& operator>>(char&);\n\ - A& operator>>(char*);\n\ - A& operator>>(short&);\n\ - A& operator>>(unsigned short&);\n\ - A& operator>>(int&);\n\ - A& operator>>(unsigned int&);\n\ - A& operator>>(int64_t&);\n\ - A& operator>>(uint64_t&);\n\ - A& operator>>(float&);\n\ - A& operator>>(double&);\n\ - A& operator>>(Char&);\n\ - A& operator>>(ByteArray&);\n\ - A& operator>>(String&);\n\ - };\n"; - const char* xmlCode = "\ + const char cppCode[] = R"(#include <cstdint> + +struct Char {}; +struct ByteArray {}; +struct String {}; + +struct A { + A& operator>>(char&); + A& operator>>(char*); + A& operator>>(short&); + A& operator>>(unsigned short&); + A& operator>>(int&); + A& operator>>(unsigned int&); + A& operator>>(int64_t&); + A& operator>>(uint64_t&); + A& operator>>(float&); + A& operator>>(double&); + A& operator>>(Char&); + A& operator>>(ByteArray&); + A& operator>>(String&); +}; +)"; + + const char xmlCode[] = "\ <typesystem package='Foo'>\n\ <primitive-type name='char'/>\n\ <primitive-type name='short'/>\n\ @@ -87,25 +68,25 @@ void TestRemoveOperatorMethod::testRemoveOperatorMethod() </object-type>\n\ </typesystem>\n"; QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false)); - QVERIFY(!builder.isNull()); + QVERIFY(builder); AbstractMetaClassList classes = builder->classes(); - const AbstractMetaClass *classA = AbstractMetaClass::findClass(classes, QLatin1String("A")); + const auto classA = AbstractMetaClass::findClass(classes, "A"); QVERIFY(classA); QCOMPARE(classA->functions().size(), 14); QStringList removedSignatures; - removedSignatures.append(QLatin1String("operator>>(char&)")); - removedSignatures.append(QLatin1String("operator>>(char*)")); - removedSignatures.append(QLatin1String("operator>>(short&)")); - removedSignatures.append(QLatin1String("operator>>(unsigned short&)")); - removedSignatures.append(QLatin1String("operator>>(int&)")); - removedSignatures.append(QLatin1String("operator>>(unsigned int&)")); - removedSignatures.append(QLatin1String("operator>>(int64_t&)")); - removedSignatures.append(QLatin1String("operator>>(uint64_t&)")); - removedSignatures.append(QLatin1String("operator>>(float&)")); - removedSignatures.append(QLatin1String("operator>>(double&)")); - removedSignatures.append(QLatin1String("operator>>(Char&)")); - removedSignatures.append(QLatin1String("operator>>(String&)")); - int notRemoved = classA->functions().size(); + removedSignatures.append(u"operator>>(char&)"_s); + removedSignatures.append(u"operator>>(char*)"_s); + removedSignatures.append(u"operator>>(short&)"_s); + removedSignatures.append(u"operator>>(unsigned short&)"_s); + removedSignatures.append(u"operator>>(int&)"_s); + removedSignatures.append(u"operator>>(unsigned int&)"_s); + removedSignatures.append(u"operator>>(int64_t&)"_s); + removedSignatures.append(u"operator>>(uint64_t&)"_s); + removedSignatures.append(u"operator>>(float&)"_s); + removedSignatures.append(u"operator>>(double&)"_s); + removedSignatures.append(u"operator>>(Char&)"_s); + removedSignatures.append(u"operator>>(String&)"_s); + auto notRemoved = classA->functions().size(); for (const auto &f : classA->functions()) { QCOMPARE(f->isModifiedRemoved(), bool(removedSignatures.contains(f->minimalSignature()))); notRemoved -= int(f->isModifiedRemoved()); |