diff options
Diffstat (limited to 'sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp')
-rw-r--r-- | sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp b/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp index 3f687186e..17a069b5e 100644 --- a/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp @@ -15,29 +15,30 @@ 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\ @@ -67,9 +68,9 @@ 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, u"A"); + const auto classA = AbstractMetaClass::findClass(classes, "A"); QVERIFY(classA); QCOMPARE(classA->functions().size(), 14); QStringList removedSignatures; @@ -85,7 +86,7 @@ void TestRemoveOperatorMethod::testRemoveOperatorMethod() removedSignatures.append(u"operator>>(double&)"_s); removedSignatures.append(u"operator>>(Char&)"_s); removedSignatures.append(u"operator>>(String&)"_s); - int notRemoved = classA->functions().size(); + auto notRemoved = classA->functions().size(); for (const auto &f : classA->functions()) { QCOMPARE(f->isModifiedRemoved(), bool(removedSignatures.contains(f->minimalSignature()))); notRemoved -= int(f->isModifiedRemoved()); |