aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testaddfunction.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-12-23 15:10:17 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:21 -0300
commit4889efc199243af54cf71accffb3f9554cba933d (patch)
treec08e9b0b65074868454f09807c51455a582a5410 /tests/testaddfunction.cpp
parentab94961a639cc7b364fcb1e3f68531792c312990 (diff)
Added the "<custom-type>" tag, and better requirements for function signatures.sb-0.10.10
Trying to find a non-qualified (without scope information) class, found in a function signature or return type, was a bad idea for it makes the parsing awfully slow when dealing with huge libraries. If the user writes a type in short form in a function signature (e.g. "SomeClass", instead of "Namespace::SomeClass"), APIExtractor will exit with a message indicating the error and the possible candidates for the type. The "<custom-type>" tag is for types of the target language ("PyObject" in Python, for instance) and will be handled by the generator. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Paulo Alcantara <pcacjr@gmail.com>
Diffstat (limited to 'tests/testaddfunction.cpp')
-rw-r--r--tests/testaddfunction.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/testaddfunction.cpp b/tests/testaddfunction.cpp
index beb49fa18..c1189c346 100644
--- a/tests/testaddfunction.cpp
+++ b/tests/testaddfunction.cpp
@@ -67,7 +67,7 @@ void TestAddFunction::testAddFunction()
{
const char cppCode[] = "struct B {}; struct A { void a(int); };";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
<primitive-type name='int' />\
<primitive-type name='float' />\
<value-type name='B' />\
@@ -108,7 +108,8 @@ void TestAddFunction::testAddFunctionConstructor()
{
const char cppCode[] = "struct A { A() {} };";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
+ <primitive-type name='int' />\
<value-type name='A'>\
<add-function signature='A(int)' />\
</value-type>\
@@ -130,7 +131,7 @@ void TestAddFunction::testAddFunctionTagDefaultValues()
{
const char cppCode[] = "struct A {};";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
<value-type name='A'>\
<add-function signature='func()' />\
</value-type>\
@@ -151,7 +152,7 @@ void TestAddFunction::testAddFunctionCodeSnippets()
{
const char cppCode[] = "struct A {};";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
<value-type name='A'>\
<add-function signature='func()'>\
<inject-code class='target' position='end'>Hi!, I am the code.</inject-code>\
@@ -178,7 +179,7 @@ void TestAddFunction::testAddFunctionWithoutParenteses()
const char cppCode[] = "struct A {};";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
<value-type name='A'>\
<add-function signature='func'>\
<inject-code class='target' position='end'>Hi!, I am the code.</inject-code>\
@@ -207,7 +208,7 @@ void TestAddFunction::testAddFunctionWithDefaultArgs()
const char cppCode[] = "struct A { };";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
<primitive-type name='int'/> \
<value-type name='A'>\
<add-function signature='func(int, int)'>\
@@ -232,7 +233,7 @@ void TestAddFunction::testAddFunctionAtModuleLevel()
{
const char cppCode[] = "struct A { };";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
<primitive-type name='int'/> \
<value-type name='A'/>\
<add-function signature='func(int, int)'>\
@@ -270,7 +271,7 @@ void TestAddFunction::testAddFunctionWithVarargs()
const char cppCode[] = "struct A {};";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
<primitive-type name='int'/> \
<primitive-type name='char'/> \
<value-type name='A'>\
@@ -293,7 +294,7 @@ void TestAddFunction::testAddStaticFunction()
{
const char cppCode[] = "struct A { };";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
<primitive-type name='int'/> \
<value-type name='A'>\
<add-function signature='func(int, int)' static='yes'>\
@@ -314,7 +315,7 @@ void TestAddFunction::testAddGlobalFunction()
{
const char cppCode[] = "struct A { };struct B {};";
const char xmlCode[] = "\
- <typesystem package=\"Foo\">\
+ <typesystem package='Foo'>\
<primitive-type name='int'/> \
<value-type name='A' />\
<add-function signature='globalFunc(int, int)' static='yes'>\
@@ -385,9 +386,10 @@ void TestAddFunction::testAddFunctionOnTypedef()
const char cppCode[] = "template<class T> class Foo { }; typedef Foo<int> FooInt;";
const char xmlCode[] = "\
<typesystem package='Package'>\
+ <custom-type name='PySequence'/>\
<primitive-type name='int'/>\
<value-type name='FooInt'>\
- <add-function signature='FooInt(PySequence*)'>\
+ <add-function signature='FooInt(PySequence)'>\
<inject-code class='target' position='beginning'>custom_code();</inject-code>\
</add-function>\
<add-function signature='method()'>\