aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testfunctiontag.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testfunctiontag.cpp')
-rw-r--r--tests/testfunctiontag.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/testfunctiontag.cpp b/tests/testfunctiontag.cpp
index 79e3142a..378baf47 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"