From 2cf33f010b56520bdefacf5a93e15a580f48e641 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Mon, 28 Jun 2010 20:33:34 -0300 Subject: Adds test case to namespace members, namely enums and functions. --- tests/testnamespace.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 tests/testnamespace.cpp (limited to 'tests/testnamespace.cpp') diff --git a/tests/testnamespace.cpp b/tests/testnamespace.cpp new file mode 100644 index 000000000..a860b35eb --- /dev/null +++ b/tests/testnamespace.cpp @@ -0,0 +1,57 @@ +/* +* This file is part of the API Extractor project. +* +* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +* +* Contact: PySide team +* +* 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 "testnamespace.h" +#include +#include "testutil.h" + +void TestNamespace::testNamespaceMembers() +{ + const char* cppCode = "\ + namespace Namespace\ + {\ + enum Option {\ + OpZero,\ + OpOne\ + };\ + void foo(Option opt);\ + };"; + const char* xmlCode = "\ + \ + \ + \ + "; + TestUtil t(cppCode, xmlCode, false); + AbstractMetaClassList classes = t.builder()->classes(); + AbstractMetaClass* ns = classes.findClass("Namespace"); + QVERIFY(ns); + const AbstractMetaEnum* metaEnum = ns->findEnum("Option"); + QVERIFY(metaEnum); + const AbstractMetaFunction* func = ns->findFunction("foo"); + QVERIFY(func); +} + +QTEST_APPLESS_MAIN(TestNamespace) + +#include "testnamespace.moc" + -- cgit v1.2.3