aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/testfunctiontag.cpp25
-rw-r--r--tests/testfunctiontag.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/testfunctiontag.cpp b/tests/testfunctiontag.cpp
index 79e3142a5..378baf479 100644
--- a/tests/testfunctiontag.cpp
+++ b/tests/testfunctiontag.cpp
@@ -58,6 +58,31 @@ void TestFunctionTag::testFunctionTagForAllSignatures()
QCOMPARE(t.builder()->globalFunctions().size(), 2);
}
+void TestFunctionTag::testRenameGlobalFunction()
+{
+ const char* cppCode ="void global_function_with_ugly_name();";
+ const char* xmlCode = "\
+ <typesystem package='Foo'> \
+ <function signature='global_function_with_ugly_name()' rename='smooth' />\
+ </typesystem>";
+ TestUtil t(cppCode, xmlCode, false);
+
+ FunctionTypeEntry* func = (FunctionTypeEntry*) TypeDatabase::instance()->findType("global_function_with_ugly_name");
+ QVERIFY(func);
+
+ QCOMPARE(t.builder()->globalFunctions().size(), 1);
+ const AbstractMetaFunction* metaFunc = t.builder()->globalFunctions().first();
+
+ QVERIFY(metaFunc);
+ QCOMPARE(metaFunc->modifications().size(), 1);
+ QVERIFY(metaFunc->modifications().first().isRenameModifier());
+ QCOMPARE(metaFunc->modifications().first().renamedTo(), QString("smooth"));
+
+ QCOMPARE(metaFunc->name(), QString("smooth"));
+ QCOMPARE(metaFunc->originalName(), QString("global_function_with_ugly_name"));
+ QCOMPARE(metaFunc->minimalSignature(), QString("global_function_with_ugly_name()"));
+}
+
QTEST_APPLESS_MAIN(TestFunctionTag)
#include "testfunctiontag.moc"
diff --git a/tests/testfunctiontag.h b/tests/testfunctiontag.h
index 8f42774c6..2edd1c4de 100644
--- a/tests/testfunctiontag.h
+++ b/tests/testfunctiontag.h
@@ -31,6 +31,7 @@ class TestFunctionTag : public QObject
private slots:
void testFunctionTagForSpecificSignature();
void testFunctionTagForAllSignatures();
+ void testRenameGlobalFunction();
};
#endif