diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-11-13 10:37:09 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-11-14 18:55:16 +0000 |
commit | a6dd968379935452462b5785e937c37b3561425f (patch) | |
tree | a5948a790b2a0f765a1b0e10231b0484b7502fd4 /sources/shiboken6/ApiExtractor/tests | |
parent | d06005c8b0acbb52c0ee74f2ccb8bc64fd482d18 (diff) |
shiboken6: Use std::optional for returning AbstractMetaType
Remove its invalid state.
Remove a few checks that apparently originated from the old
code where AbstractMetaType * = 0 meant void.
Change-Id: Ifc938c011f07f4b5316f708f6cce1e98bcaa8125
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/tests')
4 files changed, 4 insertions, 10 deletions
diff --git a/sources/shiboken6/ApiExtractor/tests/testabstractmetatype.cpp b/sources/shiboken6/ApiExtractor/tests/testabstractmetatype.cpp index 0fab1bf07..e65b0f214 100644 --- a/sources/shiboken6/ApiExtractor/tests/testabstractmetatype.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testabstractmetatype.cpp @@ -77,7 +77,7 @@ void TestAbstractMetaType::testConstCharPtrType() AbstractMetaFunction *func = builder->globalFunctions().constFirst(); AbstractMetaType rtype = func->type(); // Test properties of const char* - QVERIFY(rtype); + QVERIFY(!rtype.isVoid()); QCOMPARE(rtype.package(), QLatin1String("Foo")); QCOMPARE(rtype.name(), QLatin1String("char")); QVERIFY(rtype.isConstant()); @@ -150,7 +150,7 @@ void TestAbstractMetaType::testCharType() AbstractMetaFunction *func = functions.constFirst(); AbstractMetaType rtype = func->type(); // Test properties of const char* - QVERIFY(rtype); + QVERIFY(!rtype.isVoid()); QCOMPARE(rtype.package(), QLatin1String("Foo")); QCOMPARE(rtype.name(), QLatin1String("char")); QVERIFY(!rtype.isConstant()); diff --git a/sources/shiboken6/ApiExtractor/tests/testcontainer.cpp b/sources/shiboken6/ApiExtractor/tests/testcontainer.cpp index 515eb520e..3ee39e4ec 100644 --- a/sources/shiboken6/ApiExtractor/tests/testcontainer.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testcontainer.cpp @@ -94,7 +94,6 @@ void TestContainer::testListOfValueType() QCOMPARE(classA->templateBaseClassInstantiations().count(), 1); const AbstractMetaType templateInstanceType = classA->templateBaseClassInstantiations().constFirst(); - QVERIFY(templateInstanceType); QCOMPARE(templateInstanceType.indirections(), 0); QVERIFY(!templateInstanceType.typeEntry()->isObject()); diff --git a/sources/shiboken6/ApiExtractor/tests/testnumericaltypedef.cpp b/sources/shiboken6/ApiExtractor/tests/testnumericaltypedef.cpp index 54984620b..d613074fe 100644 --- a/sources/shiboken6/ApiExtractor/tests/testnumericaltypedef.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testnumericaltypedef.cpp @@ -62,13 +62,11 @@ void TestNumericalTypedef::testNumericalTypedef() QCOMPARE(funcReal->minimalSignature(), QLatin1String("funcReal(real)")); const AbstractMetaType doubleType = funcDouble->arguments().constFirst().type(); - QVERIFY(doubleType); QCOMPARE(doubleType.cppSignature(), QLatin1String("double")); QVERIFY(doubleType.isPrimitive()); QVERIFY(doubleType.typeEntry()->isCppPrimitive()); const AbstractMetaType realType = funcReal->arguments().constFirst().type(); - QVERIFY(realType); QCOMPARE(realType.cppSignature(), QLatin1String("real")); QVERIFY(realType.isPrimitive()); QVERIFY(realType.typeEntry()->isCppPrimitive()); @@ -104,13 +102,11 @@ void TestNumericalTypedef::testUnsignedNumericalTypedef() QCOMPARE(funcUShort->minimalSignature(), QLatin1String("funcUShort(custom_ushort)")); const AbstractMetaType unsignedShortType = funcUnsignedShort->arguments().constFirst().type(); - QVERIFY(unsignedShortType); QCOMPARE(unsignedShortType.cppSignature(), QLatin1String("unsigned short")); QVERIFY(unsignedShortType.isPrimitive()); QVERIFY(unsignedShortType.typeEntry()->isCppPrimitive()); const AbstractMetaType ushortType = funcUShort->arguments().constFirst().type(); - QVERIFY(ushortType); QCOMPARE(ushortType.cppSignature(), QLatin1String("custom_ushort")); QVERIFY(ushortType.isPrimitive()); QVERIFY(ushortType.typeEntry()->isCppPrimitive()); diff --git a/sources/shiboken6/ApiExtractor/tests/testtemplates.cpp b/sources/shiboken6/ApiExtractor/tests/testtemplates.cpp index 38199a869..2ddccc900 100644 --- a/sources/shiboken6/ApiExtractor/tests/testtemplates.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testtemplates.cpp @@ -79,7 +79,7 @@ namespace Internet { QVERIFY(classB); const AbstractMetaFunction* func = classB->findFunction(QLatin1String("list")); AbstractMetaType funcType = func->type(); - QVERIFY(funcType); + QVERIFY(!funcType.isVoid()); QCOMPARE(funcType.cppSignature(), QLatin1String("QList<Internet::Url >")); } @@ -397,7 +397,6 @@ typedef BaseTemplateClass<TypeOne> TypeOneClass; AbstractMetaTypeList instantiations = one->templateBaseClassInstantiations(); QCOMPARE(instantiations.count(), 1); const AbstractMetaType &inst = instantiations.constFirst(); - QVERIFY(inst); QVERIFY(!inst.isEnum()); QVERIFY(!inst.typeEntry()->isEnum()); QVERIFY(inst.typeEntry()->isEnumValue()); @@ -446,7 +445,7 @@ typedef Vector<int> IntVector; const AbstractMetaFunction* otherMethod = vector->findFunction(QLatin1String("otherMethod")); QVERIFY(otherMethod); QCOMPARE(otherMethod->signature(), QLatin1String("otherMethod()")); - QVERIFY(otherMethod->type()); + QVERIFY(!otherMethod->type().isVoid()); QCOMPARE(otherMethod->type().cppSignature(), QLatin1String("Vector<int >")); } |