aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-02-17 10:15:45 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:15 -0300
commitd63acce85c01257af96809f1081ab479d1f703a8 (patch)
treee78a9e9f566dff5aac4795c325745d4996b3f269 /tests
parent2ca6e422c0a4c58fad74fe523abb25716df81ce2 (diff)
Added a depth counter to avoid segmentation faults when discarding type entries.
And an unit test was added. Reviewed by Lauro Moura <lauro.neto@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testdroptypeentries.cpp28
-rw-r--r--tests/testdroptypeentries.h2
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/testdroptypeentries.cpp b/tests/testdroptypeentries.cpp
index 159bb67a9..5e646eac9 100644
--- a/tests/testdroptypeentries.cpp
+++ b/tests/testdroptypeentries.cpp
@@ -104,6 +104,34 @@ void TestDropTypeEntries::testDontDropEntries()
QVERIFY(td->findType("funcB"));
}
+static const char* cppCode2 ="\
+ struct ValueA {\
+ void func();\
+ };\
+";
+
+static const char* xmlCode2 = "\
+<typesystem package='Foo'>\
+ <value-type name='ValueA'>\
+ <modify-function signature='func()'>\
+ <remove class='all' />\
+ </modify-function>\
+ </value-type>\
+</typesystem>";
+
+void TestDropTypeEntries::testDropEntryWithChildTags()
+{
+ QStringList droppedEntries("Foo.ValueA");
+ TestUtil t(cppCode2, xmlCode2, false, 0, droppedEntries);
+ QVERIFY(!t.builder()->classes().findClass("ValueA"));
+}
+
+void TestDropTypeEntries::testDontDropEntryWithChildTags()
+{
+ TestUtil t(cppCode2, xmlCode2, false);
+ QVERIFY(t.builder()->classes().findClass("ValueA"));
+}
+
QTEST_APPLESS_MAIN(TestDropTypeEntries)
#include "testdroptypeentries.moc"
diff --git a/tests/testdroptypeentries.h b/tests/testdroptypeentries.h
index d03f82742..e91292c12 100644
--- a/tests/testdroptypeentries.h
+++ b/tests/testdroptypeentries.h
@@ -32,6 +32,8 @@ class TestDropTypeEntries : public QObject
private slots:
void testDropEntries();
void testDontDropEntries();
+ void testDropEntryWithChildTags();
+ void testDontDropEntryWithChildTags();
};
#endif