From a3d621fbde0d3ee7e852ba43f8b5ac398c902ff2 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 21 Jul 2021 12:38:15 +0200 Subject: [PATCH] CppTools: Move ProjectFileCategorizer tests to plugin Change-Id: I51d66d9ff9a14e2dd04cf25448ccc8c85bcbce97 Reviewed-by: Christian Stenger --- src/plugins/cpptools/cpptoolsplugin.h | 7 + .../cpptools/cpptoolsunittestfiles.pri | 6 +- src/plugins/cpptools/projectinfo_test.cpp | 105 +++++++++ tests/unit/unittest/CMakeLists.txt | 14 -- .../cppprojectfilecategorizer-test.cpp | 200 ------------------ .../unit/unittest/mimedatabase-utilities.cpp | 63 ------ tests/unit/unittest/mimedatabase-utilities.h | 33 --- tests/unit/unittest/unittest.pro | 9 - tests/unit/unittest/unittest.qbs | 30 +-- 9 files changed, 115 insertions(+), 352 deletions(-) delete mode 100644 tests/unit/unittest/cppprojectfilecategorizer-test.cpp delete mode 100644 tests/unit/unittest/mimedatabase-utilities.cpp delete mode 100644 tests/unit/unittest/mimedatabase-utilities.h diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h index 0aabf245775..203cab22d75 100644 --- a/src/plugins/cpptools/cpptoolsplugin.h +++ b/src/plugins/cpptools/cpptoolsplugin.h @@ -254,6 +254,13 @@ private slots: void test_headerPathFilter_removeGccInternalPathsExceptForStandardPaths(); void test_headerPathFilter_clangHeadersAndCppIncludesPathsOrderNoVersion(); void test_headerPathFilter_clangHeadersAndCppIncludesPathsOrderAndroidClang(); + void test_projectFileCategorizer_c(); + void test_projectFileCategorizer_cxxWithUnambiguousHeaderSuffix(); + void test_projectFileCategorizer_cxxWithAmbiguousHeaderSuffix(); + void test_projectFileCategorizer_objectiveC(); + void test_projectFileCategorizer_objectiveCxx(); + void test_projectFileCategorizer_mixedCAndCxx(); + void test_projectFileCategorizer_ambiguousHeaderOnly(); #endif private: diff --git a/src/plugins/cpptools/cpptoolsunittestfiles.pri b/src/plugins/cpptools/cpptoolsunittestfiles.pri index 83548cd26ea..64167bd2975 100644 --- a/src/plugins/cpptools/cpptoolsunittestfiles.pri +++ b/src/plugins/cpptools/cpptoolsunittestfiles.pri @@ -7,11 +7,9 @@ shared { HEADERS += \ $$PWD/cppprojectfile.h \ $$PWD/senddocumenttracker.h \ - $$PWD/projectpart.h \ - $$PWD/cppprojectfilecategorizer.h + $$PWD/projectpart.h SOURCES += \ $$PWD/cppprojectfile.cpp \ $$PWD/senddocumenttracker.cpp \ - $$PWD/projectpart.cpp \ - $$PWD/cppprojectfilecategorizer.cpp + $$PWD/projectpart.cpp diff --git a/src/plugins/cpptools/projectinfo_test.cpp b/src/plugins/cpptools/projectinfo_test.cpp index 520ebe23d34..e371e388a61 100644 --- a/src/plugins/cpptools/projectinfo_test.cpp +++ b/src/plugins/cpptools/projectinfo_test.cpp @@ -23,6 +23,7 @@ ** ****************************************************************************/ +#include "cppprojectfilecategorizer.h" #include "cppprojectinfogenerator.h" #include "cppprojectpartchooser.h" #include "cpptoolsplugin.h" @@ -714,5 +715,109 @@ void CppToolsPlugin::test_headerPathFilter_clangHeadersAndCppIncludesPathsOrderA t.builtIn("C:/Android/sdk/ndk-bundle/sysroot/usr/include")})); } +void CppToolsPlugin::test_projectFileCategorizer_c() +{ + const ProjectFileCategorizer categorizer({}, {"foo.c", "foo.h"}); + const ProjectFiles expected { + ProjectFile("foo.c", ProjectFile::CSource), + ProjectFile("foo.h", ProjectFile::CHeader), + }; + + QCOMPARE(categorizer.cSources(), expected); + QVERIFY(categorizer.cxxSources().isEmpty()); + QVERIFY(categorizer.objcSources().isEmpty()); + QVERIFY(categorizer.objcxxSources().isEmpty()); +} + +void CppToolsPlugin::test_projectFileCategorizer_cxxWithUnambiguousHeaderSuffix() +{ + const ProjectFileCategorizer categorizer({}, {"foo.cpp", "foo.hpp"}); + const ProjectFiles expected { + ProjectFile("foo.cpp", ProjectFile::CXXSource), + ProjectFile("foo.hpp", ProjectFile::CXXHeader), + }; + + QCOMPARE(categorizer.cxxSources(), expected); + QVERIFY(categorizer.cSources().isEmpty()); + QVERIFY(categorizer.objcSources().isEmpty()); + QVERIFY(categorizer.objcxxSources().isEmpty()); +} + +void CppToolsPlugin::test_projectFileCategorizer_cxxWithAmbiguousHeaderSuffix() +{ + const ProjectFiles expected { + ProjectFile("foo.cpp", ProjectFile::CXXSource), + ProjectFile("foo.h", ProjectFile::CXXHeader), + }; + + const ProjectFileCategorizer categorizer({}, {"foo.cpp", "foo.h"}); + + QCOMPARE(categorizer.cxxSources(), expected); + QVERIFY(categorizer.cSources().isEmpty()); + QVERIFY(categorizer.objcSources().isEmpty()); + QVERIFY(categorizer.objcxxSources().isEmpty()); +} + +void CppToolsPlugin::test_projectFileCategorizer_objectiveC() +{ + const ProjectFiles expected { + ProjectFile("foo.m", ProjectFile::ObjCSource), + ProjectFile("foo.h", ProjectFile::ObjCHeader), + }; + + const ProjectFileCategorizer categorizer({}, {"foo.m", "foo.h"}); + + QCOMPARE(categorizer.objcSources(), expected); + QVERIFY(categorizer.cxxSources().isEmpty()); + QVERIFY(categorizer.cSources().isEmpty()); + QVERIFY(categorizer.objcxxSources().isEmpty()); +} + +void CppToolsPlugin::test_projectFileCategorizer_objectiveCxx() +{ + const ProjectFiles expected { + ProjectFile("foo.mm", ProjectFile::ObjCXXSource), + ProjectFile("foo.h", ProjectFile::ObjCXXHeader), + }; + + const ProjectFileCategorizer categorizer({}, {"foo.mm", "foo.h"}); + + QCOMPARE(categorizer.objcxxSources(), expected); + QVERIFY(categorizer.objcSources().isEmpty()); + QVERIFY(categorizer.cSources().isEmpty()); + QVERIFY(categorizer.cxxSources().isEmpty()); +} + +void CppToolsPlugin::test_projectFileCategorizer_mixedCAndCxx() +{ + const ProjectFiles expectedCxxSources { + ProjectFile("foo.cpp", ProjectFile::CXXSource), + ProjectFile("foo.h", ProjectFile::CXXHeader), + ProjectFile("bar.h", ProjectFile::CXXHeader), + }; + const ProjectFiles expectedCSources { + ProjectFile("bar.c", ProjectFile::CSource), + ProjectFile("foo.h", ProjectFile::CHeader), + ProjectFile("bar.h", ProjectFile::CHeader), + }; + + const ProjectFileCategorizer categorizer({}, {"foo.cpp", "foo.h", "bar.c", "bar.h"}); + + QCOMPARE(categorizer.cxxSources(), expectedCxxSources); + QCOMPARE(categorizer.cSources(), expectedCSources); + QVERIFY(categorizer.objcSources().isEmpty()); + QVERIFY(categorizer.objcxxSources().isEmpty()); +} + +void CppToolsPlugin::test_projectFileCategorizer_ambiguousHeaderOnly() +{ + const ProjectFileCategorizer categorizer({}, {"foo.h"}); + + QCOMPARE(categorizer.cSources(), {ProjectFile("foo.h", ProjectFile::CHeader)}); + QCOMPARE(categorizer.cxxSources(), {ProjectFile("foo.h", ProjectFile::CXXHeader)}); + QCOMPARE(categorizer.objcSources(), {ProjectFile("foo.h", ProjectFile::ObjCHeader)}); + QCOMPARE(categorizer.objcxxSources(), {ProjectFile("foo.h", ProjectFile::ObjCXXHeader)}); +} + } // namespace Internal } // namespace CppTools diff --git a/tests/unit/unittest/CMakeLists.txt b/tests/unit/unittest/CMakeLists.txt index 00b32293e01..596ab24d643 100644 --- a/tests/unit/unittest/CMakeLists.txt +++ b/tests/unit/unittest/CMakeLists.txt @@ -36,14 +36,12 @@ add_qtc_test(unittest GTEST QTC_RESOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator" TESTDATA_DIR="${CMAKE_CURRENT_BINARY_DIR}/data" ECHOSERVER="$/echo" - CPPTOOLS_JSON="${CMAKE_CURRENT_BINARY_DIR}/CppTools.json" SOURCES abstractviewmock.h clientserverinprocess-test.cpp clientserveroutsideprocess-test.cpp compare-operators.h conditionally-disabled-tests.h - cppprojectfilecategorizer-test.cpp dummyclangipcclient.h dynamicastmatcherdiagnosticcontainer-matcher.h eventspy.cpp eventspy.h @@ -59,7 +57,6 @@ add_qtc_test(unittest GTEST lastchangedrowid-test.cpp lineprefixer-test.cpp matchingtext-test.cpp - mimedatabase-utilities.cpp mimedatabase-utilities.h mockclangcodemodelclient.h mockclangcodemodelserver.h mockcppmodelmanager.h @@ -165,16 +162,6 @@ add_custom_command(TARGET unittest POST_BUILD "${CMAKE_CURRENT_BINARY_DIR}/data" ) -# create fake CppTools.json for the mime type definitions -file(READ "../../../src/plugins/cpptools/CppTools.json.in" plugin_json_in) -string(REPLACE "\\\"" "\"" plugin_json_in ${plugin_json_in}) -string(REPLACE "\\'" "'" plugin_json_in ${plugin_json_in}) -string(REPLACE "$$QTCREATOR_VERSION" "${IDE_VERSION}" plugin_json_in ${plugin_json_in}) -string(REPLACE "$$QTCREATOR_COMPAT_VERSION" "${IDE_VERSION_COMPAT}" plugin_json_in ${plugin_json_in}) -string(REPLACE "$$QTCREATOR_COPYRIGHT_YEAR" "${IDE_COPYRIGHT_YEAR}" plugin_json_in ${plugin_json_in}) -string(REPLACE "$$dependencyList" "\"Dependencies\" : []" plugin_json_in ${plugin_json_in}) -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CppTools.json" ${plugin_json_in}) - extend_qtc_test(unittest CONDITION TARGET libclang INCLUDES "${CLANG_INCLUDE_DIRS}" @@ -452,7 +439,6 @@ extend_qtc_test(unittest cppprojectfile.cpp cppprojectfile.h senddocumenttracker.cpp senddocumenttracker.h projectpart.cpp projectpart.h - cppprojectfilecategorizer.cpp cppprojectfilecategorizer.h ) extend_qtc_test(unittest diff --git a/tests/unit/unittest/cppprojectfilecategorizer-test.cpp b/tests/unit/unittest/cppprojectfilecategorizer-test.cpp deleted file mode 100644 index 5abcbc59a82..00000000000 --- a/tests/unit/unittest/cppprojectfilecategorizer-test.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "googletest.h" -#include "gtest-qt-printing.h" -#include "mimedatabase-utilities.h" - -#include -#include - -#include -#include - -using CppTools::ProjectFile; -using CppTools::ProjectFiles; -using CppTools::ProjectFileCategorizer; - -using testing::IsNull; -using testing::NotNull; -using testing::Eq; -using testing::Gt; -using testing::Contains; -using testing::EndsWith; -using testing::AllOf; - -namespace CppTools { - -void PrintTo(const ProjectFile &projectFile, std::ostream *os) -{ - *os << "ProjectFile("; - QString output; - QDebug(&output) << projectFile; - *os << qPrintable(output); - *os << ")"; -} - -} // namespace CppTools - -namespace { - -class ProjectFileCategorizer : public ::testing::Test -{ -protected: - void SetUp() override; - - static ProjectFiles singleFile(const QString &filePath, ProjectFile::Kind kind); - -protected: - const QString dummyProjectPartName; -}; - -using ProjectFileCategorizerVerySlowTest = ProjectFileCategorizer; - -TEST_F(ProjectFileCategorizerVerySlowTest, C) -{ - const QStringList inputFilePaths = QStringList() << "foo.c" << "foo.h"; - const ProjectFiles expected { - ProjectFile("foo.c", ProjectFile::CSource), - ProjectFile("foo.h", ProjectFile::CHeader), - }; - - ::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths}; - - ASSERT_THAT(categorizer.cSources(), Eq(expected)); - ASSERT_TRUE(categorizer.cxxSources().isEmpty()); - ASSERT_TRUE(categorizer.objcSources().isEmpty()); - ASSERT_TRUE(categorizer.objcxxSources().isEmpty()); -} - -TEST_F(ProjectFileCategorizerVerySlowTest, CxxWithUnambiguousHeaderSuffix) -{ - const QStringList inputFilePaths = QStringList() << "foo.cpp" << "foo.hpp"; - const ProjectFiles expected { - ProjectFile("foo.cpp", ProjectFile::CXXSource), - ProjectFile("foo.hpp", ProjectFile::CXXHeader), - }; - - ::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths}; - - ASSERT_THAT(categorizer.cxxSources(), Eq(expected)); - ASSERT_TRUE(categorizer.cSources().isEmpty()); - ASSERT_TRUE(categorizer.objcSources().isEmpty()); - ASSERT_TRUE(categorizer.objcxxSources().isEmpty()); -} - -TEST_F(ProjectFileCategorizerVerySlowTest, CxxWithAmbiguousHeaderSuffix) -{ - const QStringList inputFilePaths = QStringList() << "foo.cpp" << "foo.h"; - const ProjectFiles expected { - ProjectFile("foo.cpp", ProjectFile::CXXSource), - ProjectFile("foo.h", ProjectFile::CXXHeader), - }; - - ::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths}; - - ASSERT_THAT(categorizer.cxxSources(), Eq(expected)); - ASSERT_TRUE(categorizer.cSources().isEmpty()); - ASSERT_TRUE(categorizer.objcSources().isEmpty()); - ASSERT_TRUE(categorizer.objcxxSources().isEmpty()); -} - -TEST_F(ProjectFileCategorizerVerySlowTest, ObjectiveC) -{ - const QStringList inputFilePaths = QStringList() << "foo.m" << "foo.h"; - const ProjectFiles expected { - ProjectFile("foo.m", ProjectFile::ObjCSource), - ProjectFile("foo.h", ProjectFile::ObjCHeader), - }; - - ::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths}; - - ASSERT_THAT(categorizer.objcSources(), Eq(expected)); - ASSERT_TRUE(categorizer.cxxSources().isEmpty()); - ASSERT_TRUE(categorizer.cSources().isEmpty()); - ASSERT_TRUE(categorizer.objcxxSources().isEmpty()); -} - -TEST_F(ProjectFileCategorizerVerySlowTest, ObjectiveCxx) -{ - const QStringList inputFilePaths = QStringList() << "foo.mm" << "foo.h"; - const ProjectFiles expected { - ProjectFile("foo.mm", ProjectFile::ObjCXXSource), - ProjectFile("foo.h", ProjectFile::ObjCXXHeader), - }; - - ::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths}; - - ASSERT_THAT(categorizer.objcxxSources(), Eq(expected)); - ASSERT_TRUE(categorizer.objcSources().isEmpty()); - ASSERT_TRUE(categorizer.cSources().isEmpty()); - ASSERT_TRUE(categorizer.cxxSources().isEmpty()); -} - -TEST_F(ProjectFileCategorizerVerySlowTest, MixedCAndCxx) -{ - const QStringList inputFilePaths = QStringList() << "foo.cpp" << "foo.h" - << "bar.c" << "bar.h"; - const ProjectFiles expectedCxxSources { - ProjectFile("foo.cpp", ProjectFile::CXXSource), - ProjectFile("foo.h", ProjectFile::CXXHeader), - ProjectFile("bar.h", ProjectFile::CXXHeader), - }; - const ProjectFiles expectedCSources { - ProjectFile("bar.c", ProjectFile::CSource), - ProjectFile("foo.h", ProjectFile::CHeader), - ProjectFile("bar.h", ProjectFile::CHeader), - }; - - ::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths}; - - ASSERT_THAT(categorizer.cxxSources(), Eq(expectedCxxSources)); - ASSERT_THAT(categorizer.cSources(), Eq(expectedCSources)); - ASSERT_TRUE(categorizer.objcSources().isEmpty()); - ASSERT_TRUE(categorizer.objcxxSources().isEmpty()); -} - -TEST_F(ProjectFileCategorizerVerySlowTest, AmbiguousHeaderOnly) -{ - ::ProjectFileCategorizer categorizer{dummyProjectPartName, QStringList() << "foo.h"}; - - ASSERT_THAT(categorizer.cSources(), Eq(singleFile("foo.h", ProjectFile::CHeader))); - ASSERT_THAT(categorizer.cxxSources(), Eq(singleFile("foo.h", ProjectFile::CXXHeader))); - ASSERT_THAT(categorizer.objcSources(), Eq(singleFile("foo.h", ProjectFile::ObjCHeader))); - ASSERT_THAT(categorizer.objcxxSources(), Eq(singleFile("foo.h", ProjectFile::ObjCXXHeader))); -} - -void ProjectFileCategorizer::SetUp() -{ - ASSERT_TRUE(MimeDataBaseUtilities::addCppToolsMimeTypes()); -} - -QVectorProjectFileCategorizer::singleFile(const QString &filePath, - ProjectFile::Kind kind) -{ - return { ProjectFile(filePath, kind) }; -} - -} // anonymous namespace diff --git a/tests/unit/unittest/mimedatabase-utilities.cpp b/tests/unit/unittest/mimedatabase-utilities.cpp deleted file mode 100644 index 0a0956c190c..00000000000 --- a/tests/unit/unittest/mimedatabase-utilities.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "mimedatabase-utilities.h" - -#include -#include -#include -#include -#include - -#include -#include - -namespace MimeDataBaseUtilities -{ - -bool addCppToolsMimeTypes() -{ - static bool alreadyAdded = false; - if (alreadyAdded) - return true; - - const QString filePath = CPPTOOLS_JSON; - QFile file(filePath); - if (file.open(QIODevice::ReadOnly)) { - auto doc = QJsonDocument::fromJson(file.readAll()); - QJsonValue mimetypes = doc.object().value("Mimetypes"); - - QString mimetypeString; - if (!Utils::readMultiLineString(mimetypes, &mimetypeString)) - return false; - Utils::addMimeTypes(filePath, mimetypeString.trimmed().toUtf8()); - alreadyAdded = true; - return true; - } - - return false; -} - -} diff --git a/tests/unit/unittest/mimedatabase-utilities.h b/tests/unit/unittest/mimedatabase-utilities.h deleted file mode 100644 index 89f9ee28ae3..00000000000 --- a/tests/unit/unittest/mimedatabase-utilities.h +++ /dev/null @@ -1,33 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace MimeDataBaseUtilities -{ - bool addCppToolsMimeTypes(); -} diff --git a/tests/unit/unittest/unittest.pro b/tests/unit/unittest/unittest.pro index 99181e6b2db..6cd9315586d 100644 --- a/tests/unit/unittest/unittest.pro +++ b/tests/unit/unittest/unittest.pro @@ -55,17 +55,10 @@ QMAKE_CXXFLAGS += /bigobj /wd4267 /wd4141 /wd4146 /wd4624 QMAKE_LFLAGS += /INCREMENTAL } -# create fake CppTools.json for the mime type definitions -dependencyList = "\"Dependencies\" : []" -cpptoolsjson.input = $$PWD/../../../src/plugins/cpptools/CppTools.json.in -cpptoolsjson.output = $$OUT_PWD/CppTools.json -QMAKE_SUBSTITUTES += cpptoolsjson -DEFINES += CPPTOOLS_JSON=\"R\\\"xxx($${cpptoolsjson.output})xxx\\\"\" SOURCES += \ clientserverinprocess-test.cpp \ clientserveroutsideprocess-test.cpp \ - cppprojectfilecategorizer-test.cpp \ fakeprocess.cpp \ gtest-creator-printing.cpp \ gtest-qt-printing.cpp \ @@ -80,7 +73,6 @@ SOURCES += \ lastchangedrowid-test.cpp \ lineprefixer-test.cpp \ listmodeleditor-test.cpp \ - mimedatabase-utilities.cpp \ processevents-utilities.cpp \ readandwritemessageblock-test.cpp \ sizedarray-test.cpp \ @@ -201,7 +193,6 @@ HEADERS += \ gtest-qt-printing.h \ gtest-std-printing.h \ imagecachecollectormock.h \ - mimedatabase-utilities.h \ mockclangcodemodelclient.h \ mockclangcodemodelserver.h \ mockimagecachegenerator.h \ diff --git a/tests/unit/unittest/unittest.qbs b/tests/unit/unittest/unittest.qbs index 862efdd8c6e..0838cfc63db 100644 --- a/tests/unit/unittest/unittest.qbs +++ b/tests/unit/unittest/unittest.qbs @@ -50,14 +50,13 @@ Project { QtcProduct { name: "Unit test" condition: qtc_gtest_gmock.hasRepo || qtc_gtest_gmock.externalLibsPresent - type: ["application", "autotest", "json_copy"] + type: ["application", "autotest"] consoleApplication: true destinationDirectory: FileInfo.joinPaths(project.buildDirectory, FileInfo.relativePath(project.ide_source_tree, sourceDirectory)) install: false Depends { name: "echoserver" } - Depends { name: "pluginjson" } Depends { name: "libclang"; required: false } Depends { name: "clang_defines" } @@ -75,7 +74,6 @@ Project { Depends { name: "qtc_gtest_gmock" } - pluginjson.useVcsData: false sqlite_sources.buildSharedLib: false cpp.defines: { @@ -97,7 +95,6 @@ Project { "echoserver", "echo") + '"', 'RELATIVE_DATA_PATH="' + FileInfo.relativePath(destinationDirectory, FileInfo.joinPaths(project.sourceDirectory, "share", "qtcreator")) + '"', - 'CPPTOOLS_JSON="' + FileInfo.joinPaths(destinationDirectory, "CppTools.json") + '"', ]; if (libclang.present) { defines.push("CLANG_UNIT_TESTS"); @@ -174,7 +171,6 @@ Project { "compare-operators.h", "compilationdatabaseutils-test.cpp", "conditionally-disabled-tests.h", - "cppprojectfilecategorizer-test.cpp", "createtablesqlstatementbuilder-test.cpp", "dummyclangipcclient.h", "dynamicastmatcherdiagnosticcontainer-matcher.h", @@ -192,8 +188,6 @@ Project { "gtest-qt-printing.h", "lineprefixer-test.cpp", "matchingtext-test.cpp", - "mimedatabase-utilities.cpp", - "mimedatabase-utilities.h", "mockclangcodemodelclient.h", "mockclangcodemodelserver.h", "mockcppmodelmanager.h", @@ -321,12 +315,6 @@ Project { fileTags: [] } - Group { - name: "json.in file" - files: "../../../src/plugins/cpptools/CppTools.json.in" - fileTags: "pluginJsonIn" - } - Group { name: "sources from clangbackend" condition: libclang.present @@ -484,8 +472,6 @@ Project { files: [ "cppprojectfile.cpp", "cppprojectfile.h", - "cppprojectfilecategorizer.cpp", - "cppprojectfilecategorizer.h", "projectpart.cpp", "projectpart.h", "senddocumenttracker.cpp", @@ -544,19 +530,5 @@ Project { "diagnosticlocation.h", ] } - - Rule { - inputs: "qt_plugin_metadata" - Artifact { - filePath: FileInfo.joinPaths(product.destinationDirectory, "CppTools.json") - fileTags: "json_copy" - } - prepare: { - var cmd = new JavaScriptCommand; - cmd.description = "copying " + input.fileName; - cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; - return cmd; - } - } } }