aboutsummaryrefslogtreecommitdiffstats
path: root/tests/reserve-candidates
diff options
context:
space:
mode:
authorSergio Martins <smartins@kde.org>2015-11-23 19:33:11 +0000
committerSergio Martins <smartins@kde.org>2015-11-23 19:33:11 +0000
commit3a79906150842021ec9abcf3615c176587b218f2 (patch)
treecb01762d44f04c57cc1ebcfd02d36f2ca253df6f /tests/reserve-candidates
parent5a26c8ca65166a1c6267c93bd5936b7fbdfc0568 (diff)
reserve-candidates: Also run tests on Qt < 5.3
The whole check was blacklisted, now only the offending line is. So we still get good coverage on old Qt.
Diffstat (limited to 'tests/reserve-candidates')
-rw-r--r--tests/reserve-candidates/config.json10
-rw-r--r--tests/reserve-candidates/main.cpp4
-rw-r--r--tests/reserve-candidates/main.cpp.expected (renamed from tests/reserve-candidates/test.expected)1
-rw-r--r--tests/reserve-candidates/main2.cpp9
-rw-r--r--tests/reserve-candidates/main2.cpp.expected1
5 files changed, 21 insertions, 4 deletions
diff --git a/tests/reserve-candidates/config.json b/tests/reserve-candidates/config.json
index 41ff871c..b35ec6fc 100644
--- a/tests/reserve-candidates/config.json
+++ b/tests/reserve-candidates/config.json
@@ -1,3 +1,11 @@
{
- "minimum_qt_version" : 530
+ "tests" : [
+ {
+ "filename" : "main.cpp"
+ },
+ {
+ "filename" : "main2.cpp",
+ "minimum_qt_version" : 530
+ }
+ ]
}
diff --git a/tests/reserve-candidates/main.cpp b/tests/reserve-candidates/main.cpp
index d2bd1898..72a8e916 100644
--- a/tests/reserve-candidates/main.cpp
+++ b/tests/reserve-candidates/main.cpp
@@ -105,8 +105,8 @@ void test_nesting()
foreach (int i2, b)
c << 1; // OK
- foreach (int i2, d)
- e << 1; // Warning
+
+
}
void test_misc()
diff --git a/tests/reserve-candidates/test.expected b/tests/reserve-candidates/main.cpp.expected
index 8d139934..13b51cc7 100644
--- a/tests/reserve-candidates/test.expected
+++ b/tests/reserve-candidates/main.cpp.expected
@@ -5,7 +5,6 @@ main.cpp:65:9: warning: Reserve candidate [-Wclazy-reserve-candidates]
main.cpp:69:9: warning: Reserve candidate [-Wclazy-reserve-candidates]
main.cpp:73:9: warning: Reserve candidate [-Wclazy-reserve-candidates]
main.cpp:88:13: warning: Reserve candidate [-Wclazy-reserve-candidates]
-main.cpp:109:9: warning: Reserve candidate [-Wclazy-reserve-candidates]
main.cpp:133:13: warning: Reserve candidate [-Wclazy-reserve-candidates]
main.cpp:142:13: warning: Reserve candidate [-Wclazy-reserve-candidates]
main.cpp:169:40: warning: Reserve candidate [-Wclazy-reserve-candidates]
diff --git a/tests/reserve-candidates/main2.cpp b/tests/reserve-candidates/main2.cpp
new file mode 100644
index 00000000..4c673abb
--- /dev/null
+++ b/tests/reserve-candidates/main2.cpp
@@ -0,0 +1,9 @@
+#include <QtCore/QVector>
+
+// this test only passes on Qt >= 5.3
+void test()
+{
+ QVector<int> a,b,c,d,e;
+ foreach (int i2, d)
+ e << 1; // Warning
+}
diff --git a/tests/reserve-candidates/main2.cpp.expected b/tests/reserve-candidates/main2.cpp.expected
new file mode 100644
index 00000000..df155be1
--- /dev/null
+++ b/tests/reserve-candidates/main2.cpp.expected
@@ -0,0 +1 @@
+main2.cpp:8:9: warning: Reserve candidate [-Wclazy-reserve-candidates]