summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppquickfix_test.cpp
diff options
context:
space:
mode:
authorLeander Schulten <Leander.Schulten@rwth-aachen.de>2021-01-30 22:11:04 +0100
committerLeander Schulten <Leander.Schulten@rwth-aachen.de>2021-02-04 11:40:05 +0000
commit29207e3eebb5ea7597d4160bbf171f1cec0edd5c (patch)
tree2bddd9ccf4f8f26ad51ca074bef3f7c83c58c32f /src/plugins/cppeditor/cppquickfix_test.cpp
parent0e0c2ca91c53e7bca3c8ea0a1c047a87b0873ac7 (diff)
downloadqt-creator-29207e3eebb5ea7597d4160bbf171f1cec0edd5c.tar.gz
CppEditor: Add Base Class Support for Generate Constructor QuickFix
Change-Id: Idd92229134609c0ac87aad030a6bb645ff4cce1b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfix_test.cpp')
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index e2bc42cf4c..7bfdf5b7ba 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -7878,6 +7878,75 @@ public:
QTest::newRow("default parameters")
<< header << expected << QByteArray() << QByteArray() << Inside;
+ header = R"--(
+struct Bar{
+ Bar(int i);
+};
+class@ Foo : public Bar{
+ int test;
+public:
+};
+)--";
+ expected = R"--(
+struct Bar{
+ Bar(int i);
+};
+class Foo : public Bar{
+ int test;
+public:
+ Foo(int test, int i) : Bar(i),
+ test(test)
+ {}
+};
+)--";
+ QTest::newRow("parent constructor")
+ << header << expected << QByteArray() << QByteArray() << Inside;
+
+ header = R"--(
+struct Bar{
+ Bar(int use_i = 6);
+};
+class@ Foo : public Bar{
+ int test;
+public:
+};
+)--";
+ expected = R"--(
+struct Bar{
+ Bar(int use_i = 6);
+};
+class Foo : public Bar{
+ int test;
+public:
+ Foo(int test, int use_i = 6) : Bar(use_i),
+ test(test)
+ {}
+};
+)--";
+ QTest::newRow("parent constructor with default")
+ << header << expected << QByteArray() << QByteArray() << Inside;
+
+ header = R"--(
+struct Bar{
+ Bar(int use_i = L'A', int use_i2 = u8"B");
+};
+class@ Foo : public Bar{
+public:
+};
+)--";
+ expected = R"--(
+struct Bar{
+ Bar(int use_i = L'A', int use_i2 = u8"B");
+};
+class Foo : public Bar{
+public:
+ Foo(int use_i = L'A', int use_i2 = u8"B") : Bar(use_i, use_i2)
+ {}
+};
+)--";
+ QTest::newRow("parent constructor with char/string default value")
+ << header << expected << QByteArray() << QByteArray() << Inside;
+
const QByteArray common = R"--(
namespace N{
template<typename T>