diff options
Diffstat (limited to 'sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp b/sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp index a3130e499..a7e88e437 100644 --- a/sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp @@ -31,6 +31,7 @@ #include "testutil.h" #include <abstractmetalang.h> #include <typesystem.h> +#include <typedatabase.h> void TestTypeRevision::testRevisionAttr() { @@ -67,6 +68,39 @@ void TestTypeRevision::testRevisionAttr() QCOMPARE(revEnumTypeEntry->flags()->revision(), 5); } + +void TestTypeRevision::testVersion_data() +{ + QTest::addColumn<QString>("version"); + QTest::addColumn<int>("expectedClassCount"); + + QTest::newRow("none") << QString() << 2; + QTest::newRow("1.0") << QString::fromLatin1("1.0") << 1; // Bar20 excluded + QTest::newRow("2.0") << QString::fromLatin1("2.0") << 2; +} + +void TestTypeRevision::testVersion() +{ + QFETCH(QString, version); + QFETCH(int, expectedClassCount); + + const char cppCode[] = R"CPP( +class Bar {}; +class Bar20 {}; +)CPP"; + const char xmlCode[] = R"XML( +<typesystem package="Foo"> + <value-type name="Bar"/> + <value-type name="Bar20" since="2.0"/> +</typesystem> +)XML"; + + QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, true, version)); + QVERIFY(!builder.isNull()); + + QCOMPARE(builder->classes().size(), expectedClassCount); +} + QTEST_APPLESS_MAIN(TestTypeRevision) |