aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/tests/testreferencetopointer.cpp
blob: ae85c5a86aa95caa46504e71f58b4e35f208af2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "testreferencetopointer.h"
#include <QtTest/QTest>
#include "testutil.h"
#include <abstractmetaargument.h>
#include <abstractmetafunction.h>
#include <abstractmetalang.h>
#include <abstractmetatype.h>
#include <typesystem.h>

void TestReferenceToPointer::testReferenceToPointerArgument()
{
    const char cppCode[] = "\
    struct A {};\n\
    struct B {\n\
        void dummy(A*&);\n\
    };\n";
    const char xmlCode[] = "\
    <typesystem package=\"Foo\">\n\
        <object-type name='A'/>\n\
        <object-type name='B'/>\n\
    </typesystem>\n";
    QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
    QVERIFY(builder);
    AbstractMetaClassList classes = builder->classes();
    const auto classB = AbstractMetaClass::findClass(classes, "B");
    QVERIFY(classB);
    const auto func = classB->findFunction("dummy");
    QVERIFY(func);
    QCOMPARE(func->arguments().constFirst().type().minimalSignature(), u"A*&");
}

QTEST_APPLESS_MAIN(TestReferenceToPointer)