forked from qt-creator/qt-creator
AutoTest: Update unit test projects
Replaced deprecated API by nowadays recommended code. Add missing include. Change-Id: I4012ea3ada02cd874fe534ae45d6a1c37ccbdbc7 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
var FileInfo = loadExtension("qbs.FileInfo")
|
||||
var FileInfo = require("qbs.FileInfo")
|
||||
|
||||
function getGTestDir(str) {
|
||||
function getGTestDir(Qbs, str) {
|
||||
if (!str) {
|
||||
if (qbs.hostOS.contains("linux"))
|
||||
if (Qbs.hostOS.contains("linux"))
|
||||
return "/usr/include/gtest";
|
||||
} else {
|
||||
return FileInfo.joinPaths(str, "googletest");
|
||||
@@ -10,9 +10,9 @@ function getGTestDir(str) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function getGMockDir(str) {
|
||||
function getGMockDir(Qbs, str) {
|
||||
if (!str) {
|
||||
if (qbs.hostOS.contains("linux"))
|
||||
if (Qbs.hostOS.contains("linux"))
|
||||
return "/usr/include/gmock";
|
||||
} else {
|
||||
return FileInfo.joinPaths(str, "googlemock");
|
||||
@@ -20,29 +20,29 @@ function getGMockDir(str) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function getGTestAll(str) {
|
||||
var gtest = getGTestDir(str);
|
||||
function getGTestAll(Qbs, str) {
|
||||
var gtest = getGTestDir(Qbs, str);
|
||||
if (!gtest)
|
||||
return [];
|
||||
return [FileInfo.joinPaths(gtest, "src/gtest-all.cc")];
|
||||
}
|
||||
|
||||
function getGMockAll(str) {
|
||||
var gmock = getGMockDir(str);
|
||||
function getGMockAll(Qbs, str) {
|
||||
var gmock = getGMockDir(Qbs, str);
|
||||
if (!gmock)
|
||||
return [];
|
||||
return [FileInfo.joinPaths(gmock, "src/gmock-all.cc")];
|
||||
}
|
||||
|
||||
function getGTestIncludes(str) {
|
||||
var gtest = getGTestDir(str);
|
||||
function getGTestIncludes(Qbs, str) {
|
||||
var gtest = getGTestDir(Qbs, str);
|
||||
if (!gtest)
|
||||
return [];
|
||||
return [gtest, FileInfo.joinPaths(gtest, "include")];
|
||||
}
|
||||
|
||||
function getGMockIncludes(str) {
|
||||
var mock = getGMockDir(str);
|
||||
function getGMockIncludes(Qbs, str) {
|
||||
var mock = getGMockDir(Qbs, str);
|
||||
if (!mock)
|
||||
return [];
|
||||
return [mock, FileInfo.joinPaths(mock, "include")];
|
||||
|
@@ -7,8 +7,8 @@ CppApplication {
|
||||
type: "application"
|
||||
name: "googletest1"
|
||||
|
||||
property string gtestDir: googleCommon.getGTestDir(project.googletestDir)
|
||||
property string gmockDir: googleCommon.getGMockDir(project.googletestDir)
|
||||
property string gtestDir: googleCommon.getGTestDir(qbs, project.googletestDir)
|
||||
property string gmockDir: googleCommon.getGMockDir(qbs, project.googletestDir)
|
||||
|
||||
condition: {
|
||||
if (File.exists(gtestDir) && File.exists(gmockDir))
|
||||
@@ -19,8 +19,8 @@ CppApplication {
|
||||
return false;
|
||||
}
|
||||
|
||||
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(project.googletestDir))
|
||||
.concat(googleCommon.getGMockIncludes(project.googletestDir))
|
||||
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(qbs, project.googletestDir))
|
||||
.concat(googleCommon.getGMockIncludes(qbs, project.googletestDir))
|
||||
|
||||
cpp.cxxLanguageVersion: "c++11"
|
||||
cpp.defines: ["GTEST_LANG_CXX11"]
|
||||
@@ -30,6 +30,6 @@ CppApplication {
|
||||
// own stuff
|
||||
"further.cpp",
|
||||
"main.cpp",
|
||||
].concat(googleCommon.getGTestAll(project.googletestDir))
|
||||
.concat(googleCommon.getGMockAll(project.googletestDir))
|
||||
].concat(googleCommon.getGTestAll(qbs, project.googletestDir))
|
||||
.concat(googleCommon.getGMockAll(qbs, project.googletestDir))
|
||||
}
|
||||
|
@@ -7,8 +7,8 @@ CppApplication {
|
||||
type: "application"
|
||||
name: "googletest2"
|
||||
|
||||
property string gtestDir: googleCommon.getGTestDir(project.googletestDir)
|
||||
property string gmockDir: googleCommon.getGMockDir(project.googletestDir)
|
||||
property string gtestDir: googleCommon.getGTestDir(qbs, project.googletestDir)
|
||||
property string gmockDir: googleCommon.getGMockDir(qbs, project.googletestDir)
|
||||
|
||||
Depends { name: "Qt.core" }
|
||||
|
||||
@@ -21,8 +21,8 @@ CppApplication {
|
||||
return false;
|
||||
}
|
||||
|
||||
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(project.googletestDir))
|
||||
.concat(googleCommon.getGMockIncludes(project.googletestDir))
|
||||
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(qbs, project.googletestDir))
|
||||
.concat(googleCommon.getGMockIncludes(qbs, project.googletestDir))
|
||||
|
||||
cpp.cxxLanguageVersion: "c++11"
|
||||
cpp.defines: ["GTEST_LANG_CXX11"]
|
||||
@@ -31,6 +31,6 @@ CppApplication {
|
||||
// own stuff
|
||||
"queuetest.h",
|
||||
"main.cpp",
|
||||
].concat(googleCommon.getGTestAll(project.googletestDir))
|
||||
.concat(googleCommon.getGMockAll(project.googletestDir))
|
||||
].concat(googleCommon.getGTestAll(qbs, project.googletestDir))
|
||||
.concat(googleCommon.getGMockAll(qbs, project.googletestDir))
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <QQueue>
|
||||
|
||||
class QueueTest : public ::testing::Test
|
||||
|
@@ -7,8 +7,8 @@ CppApplication {
|
||||
type: "application"
|
||||
name: "googletest3"
|
||||
|
||||
property string gtestDir: googleCommon.getGTestDir(project.googletestDir)
|
||||
property string gmockDir: googleCommon.getGMockDir(project.googletestDir)
|
||||
property string gtestDir: googleCommon.getGTestDir(qbs, project.googletestDir)
|
||||
property string gmockDir: googleCommon.getGMockDir(qbs, project.googletestDir)
|
||||
|
||||
Depends { name: "Qt.core" }
|
||||
|
||||
@@ -21,8 +21,8 @@ CppApplication {
|
||||
return false;
|
||||
}
|
||||
|
||||
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(project.googletestDir))
|
||||
.concat(googleCommon.getGMockIncludes(project.googletestDir))
|
||||
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(qbs, project.googletestDir))
|
||||
.concat(googleCommon.getGMockIncludes(qbs, project.googletestDir))
|
||||
|
||||
cpp.cxxLanguageVersion: "c++11"
|
||||
cpp.defines: ["GTEST_LANG_CXX11"]
|
||||
@@ -31,6 +31,6 @@ CppApplication {
|
||||
// own stuff
|
||||
"dummytest.h",
|
||||
"main.cpp",
|
||||
].concat(googleCommon.getGTestAll(project.googletestDir))
|
||||
.concat(googleCommon.getGMockAll(project.googletestDir))
|
||||
].concat(googleCommon.getGTestAll(qbs, project.googletestDir))
|
||||
.concat(googleCommon.getGMockAll(qbs, project.googletestDir))
|
||||
}
|
||||
|
@@ -56,8 +56,8 @@ static QMap<const char *, QStringList> testValuesSec = {
|
||||
},
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(First, DummyTest, ::testing::ValuesIn(testValues.keys()));
|
||||
INSTANTIATE_TEST_CASE_P(Second, DummyTest, ::testing::ValuesIn(testValuesSec.keys()));
|
||||
INSTANTIATE_TEST_SUITE_P(First, DummyTest, ::testing::ValuesIn(testValues.keys()));
|
||||
INSTANTIATE_TEST_SUITE_P(Second, DummyTest, ::testing::ValuesIn(testValuesSec.keys()));
|
||||
|
||||
TEST_P(DummyTest, Easy)
|
||||
{
|
||||
|
Reference in New Issue
Block a user