diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-03-22 10:31:34 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:09:57 -0300 |
commit | e8f37f7ee2b7ea6a7d25732dbd335687b5493ec3 (patch) | |
tree | 19f7164efa01f91628ac9966b082c596efb46afa /tests/testreferencetopointer.cpp | |
parent | 60c0865c6af16c91244123fe6f2c328f5fc912a4 (diff) |
Meta type minimal signature should place reference symbol after pointer symbols.
The minimalSignature method was placing '&' before '*'. For example,
the signature "foo(Bar*&)" was becoming "foo(Bar&*)".
An unit test was added to verify AbstractMetaType::minimalSignature().
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Anderson Lizardo <anderson.lizardo@openbossa.org>
Diffstat (limited to 'tests/testreferencetopointer.cpp')
-rw-r--r-- | tests/testreferencetopointer.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/testreferencetopointer.cpp b/tests/testreferencetopointer.cpp new file mode 100644 index 000000000..cd4b63b0a --- /dev/null +++ b/tests/testreferencetopointer.cpp @@ -0,0 +1,53 @@ +/* +* This file is part of the API Extractor project. +* +* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +* +* Contact: PySide team <contact@pyside.org> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +* +*/ + +#include "testreferencetopointer.h" +#include <QtTest/QTest> +#include "testutil.h" + +void TestReferenceToPointer::testReferenceToPointerArgument() +{ + const char* cppCode ="\ + struct A {};\ + struct B {\ + void dummy(A*&);\ + };\ + "; + const char* xmlCode = "\ + <typesystem package=\"Foo\"> \ + <object-type name='A' /> \ + <object-type name='B' /> \ + </typesystem>"; + TestUtil t(cppCode, xmlCode, false); + AbstractMetaClassList classes = t.builder()->classes(); + AbstractMetaClass* classB = classes.findClass("B"); + QVERIFY(classB); + const AbstractMetaFunction* func = classB->findFunction("dummy"); + QVERIFY(func); + QCOMPARE(func->arguments().first()->type()->minimalSignature(), QString("A*&")); +} + +QTEST_APPLESS_MAIN(TestReferenceToPointer) + +#include "testreferencetopointer.moc" + |