diff options
author | Renato Filho <renato.filho@openbossa.org> | 2010-05-25 16:15:05 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:10:03 -0300 |
commit | 2060c23e8d2d80c721dd4eb31a777f4be0fefdfc (patch) | |
tree | 7f2ac2dc24ef24f63befbc51fc17e091244f3446 /tests/testmodifyfunction.cpp | |
parent | 6ddb2e91990b119017819c6290ca6de6c6b6ea21 (diff) |
Created unittest to flag "since".
Diffstat (limited to 'tests/testmodifyfunction.cpp')
-rw-r--r-- | tests/testmodifyfunction.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/testmodifyfunction.cpp b/tests/testmodifyfunction.cpp index 94dbc3d9a..d45815e6c 100644 --- a/tests/testmodifyfunction.cpp +++ b/tests/testmodifyfunction.cpp @@ -52,6 +52,43 @@ void TestModifyFunction::testOwnershipTransfer() QCOMPARE(func->ownership(func->ownerClass(), TypeSystem::TargetLangCode, 0), TypeSystem::CppOwnership); } +void TestModifyFunction::testWithApiVersion() +{ + const char* cppCode ="\ + struct A {};\ + struct B {\ + virtual A* method();\ + virtual B* methodB();\ + };\ + "; + const char* xmlCode = "\ + <typesystem package='Foo'> \ + <object-type name='A' /> \ + <object-type name='B'> \ + <modify-function signature='method()' since='0.1'>\ + <modify-argument index='return'>\ + <define-ownership owner='c++' /> \ + </modify-argument>\ + </modify-function>\ + <modify-function signature='methodB()' since='0.2'>\ + <modify-argument index='return'>\ + <define-ownership owner='c++' /> \ + </modify-argument>\ + </modify-function>\ + </object-type>\ + </typesystem>"; + TestUtil t(cppCode, xmlCode, false, 0.1); + AbstractMetaClassList classes = t.builder()->classes(); + AbstractMetaClass* classB = classes.findClass("B"); + const AbstractMetaFunction* func = classB->findFunction("method"); + + QCOMPARE(func->ownership(func->ownerClass(), TypeSystem::TargetLangCode, 0), TypeSystem::CppOwnership); + + func = classB->findFunction("methodB"); + QVERIFY(func->ownership(func->ownerClass(), TypeSystem::TargetLangCode, 0) != TypeSystem::CppOwnership); +} + + QTEST_APPLESS_MAIN(TestModifyFunction) #include "testmodifyfunction.moc" |