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/testrefcounttag.cpp | |
parent | 6ddb2e91990b119017819c6290ca6de6c6b6ea21 (diff) |
Created unittest to flag "since".
Diffstat (limited to 'tests/testrefcounttag.cpp')
-rw-r--r-- | tests/testrefcounttag.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/testrefcounttag.cpp b/tests/testrefcounttag.cpp index 5d3a45c77..6f6f87367 100644 --- a/tests/testrefcounttag.cpp +++ b/tests/testrefcounttag.cpp @@ -53,6 +53,41 @@ void TestRefCountTag::testReferenceCountTag() QCOMPARE(refCount.action, ReferenceCount::Add); } +void TestRefCountTag::testWithApiVersion() +{ + const char* cppCode ="\ + struct A {};\ + struct B {\ + void keepObject(B*, B*);\ + };\ + "; + const char* xmlCode = "\ + <typesystem package=\"Foo\"> \ + <object-type name='A' /> \ + <object-type name='B'> \ + <modify-function signature='keepObject(B*, B*)'>\ + <modify-argument index='1' since='0.1'>\ + <reference-count action='add' /> \ + </modify-argument>\ + <modify-argument index='2' since='0.2'>\ + <reference-count action='add' /> \ + </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("keepObject"); + + ReferenceCount refCount = func->modifications().first().argument_mods.first().referenceCounts.first(); + QCOMPARE(refCount.action, ReferenceCount::Add); + + QCOMPARE(func->modifications().size(), 1); +} + + QTEST_APPLESS_MAIN(TestRefCountTag) #include "testrefcounttag.moc" |