diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-11-29 12:59:51 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-11-29 13:36:14 +0100 |
commit | 29c9f8080d2e2ad6ad9573612b0ea171c22d737a (patch) | |
tree | 7d811167b3992eb5c35f09599c27faa8e225f2d6 /tests | |
parent | ba4c43421126c02e34d5cf3ed25bb290c79e6343 (diff) | |
parent | 9eb66a806f098b84c22654da5aeb62a9db8e8c59 (diff) |
Merge remote-tracking branch 'origin/4.8'
Conflicts:
src/plugins/android/androidrunnerworker.cpp
Change-Id: Ibd8b99435365fb7e7d488313fd1d2b3a75adad1b
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qml/reformatter/tst_reformatter.cpp | 8 | ||||
-rw-r--r-- | tests/manual/clang-format-for-qtc/test.cpp | 6 | ||||
-rw-r--r-- | tests/unit/unittest/builddependenciesprovider-test.cpp | 66 | ||||
-rw-r--r-- | tests/unit/unittest/builddependenciesstorage-test.cpp | 30 | ||||
-rw-r--r-- | tests/unit/unittest/clang_dependency.pri | 1 | ||||
-rw-r--r-- | tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp | 8 | ||||
-rw-r--r-- | tests/unit/unittest/compileroptionsbuilder-test.cpp | 78 | ||||
-rw-r--r-- | tests/unit/unittest/data/highlightingmarks.cpp | 18 | ||||
-rw-r--r-- | tests/unit/unittest/mockbuilddependenciesprovider.h | 5 | ||||
-rw-r--r-- | tests/unit/unittest/tokenprocessor-test.cpp | 18 | ||||
-rw-r--r-- | tests/unit/unittest/unittest.pro | 6 |
13 files changed, 215 insertions, 36 deletions
diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index 9b5762f3da..4334e90aa6 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp @@ -8228,6 +8228,8 @@ static void checkNode(QmlJS::SimpleReaderNode::Ptr node, TestRewriterView *view) void tst_TestCore::writeAnnotations() { + QSKIP("We have to improve handling of emtpy lines.", SkipAll); + const QLatin1String qmlCode("\n" "import QtQuick 2.1\n" "\n" diff --git a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp index 8c60c1c498..bca2e8d7a8 100644 --- a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp +++ b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp @@ -223,8 +223,9 @@ void tst_FileFormat::testLibraryPaths() project->setSourceDirectory(testDataDir); - QStringList expectedPaths(QStringList() << SRCDIR "/otherLibrary" - << SRCDIR "/data/library"); + const QDir base(testDataDir); + const QStringList expectedPaths({base.relativeFilePath(SRCDIR "/otherLibrary"), + base.relativeFilePath(SRCDIR "/data/library")}); qDebug() << expectedPaths << project->importPaths(); QCOMPARE(project->importPaths().toSet(), expectedPaths.toSet()); delete project; diff --git a/tests/auto/qml/reformatter/tst_reformatter.cpp b/tests/auto/qml/reformatter/tst_reformatter.cpp index f3164f440e..64506195c4 100644 --- a/tests/auto/qml/reformatter/tst_reformatter.cpp +++ b/tests/auto/qml/reformatter/tst_reformatter.cpp @@ -93,10 +93,18 @@ void tst_Reformatter::test() // compare line by line int commonLines = qMin(newLines.size(), sourceLines.size()); + bool insideMultiLineComment = false; for (int i = 0; i < commonLines; ++i) { // names intentional to make 'Actual (sourceLine): ...\nExpected (newLinee): ...' line up const QString &sourceLine = sourceLines.at(i); const QString &newLinee = newLines.at(i); + if (!insideMultiLineComment && sourceLine.trimmed().startsWith("/*")) { + insideMultiLineComment = true; + sourceLines.insert(i, "\n"); + continue; + } + if (sourceLine.trimmed().endsWith("*/")) + insideMultiLineComment = false; if (sourceLine.trimmed().isEmpty() && newLinee.trimmed().isEmpty()) continue; bool fail = !QCOMPARE_NOEXIT(newLinee, sourceLine); diff --git a/tests/manual/clang-format-for-qtc/test.cpp b/tests/manual/clang-format-for-qtc/test.cpp index e5afaff130..b3cf22eaca 100644 --- a/tests/manual/clang-format-for-qtc/test.cpp +++ b/tests/manual/clang-format-for-qtc/test.cpp @@ -656,7 +656,11 @@ void extremeFunction( ++uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunbelievableLongValue; extremeFunction( - "some super duper super duper super duper super duper super duper super duper super duper long"); + "some super duper super duper super duper super duper super duper super duper long"); + + // BreakStringLiterals splits the string. + extremeFunction("some super duper super duper super duper super duper super duper super duper " + "super duper long"); } void extremeFunction2(int parameter1, diff --git a/tests/unit/unittest/builddependenciesprovider-test.cpp b/tests/unit/unittest/builddependenciesprovider-test.cpp index e829b52d60..64a9247828 100644 --- a/tests/unit/unittest/builddependenciesprovider-test.cpp +++ b/tests/unit/unittest/builddependenciesprovider-test.cpp @@ -28,6 +28,7 @@ #include "mockbuilddependenciesstorage.h" #include "mockmodifiedtimechecker.h" #include "mockbuilddependencygenerator.h" +#include "mocksqlitetransactionbackend.h" #include <builddependenciesprovider.h> @@ -54,38 +55,67 @@ MATCHER_P(HasSourceId, sourceId, std::string(negation ? "hasn't" : "has") class BuildDependenciesProvider : public testing::Test { protected: + NiceMock<MockSqliteTransactionBackend> mockSqliteTransactionBackend; NiceMock<MockBuildDependenciesStorage> mockBuildDependenciesStorage; NiceMock<MockModifiedTimeChecker> mockModifiedTimeChecker; NiceMock<MockBuildDependencyGenerator> mockBuildDependenciesGenerator; - ClangBackEnd::BuildDependenciesProvider provider{mockBuildDependenciesStorage, mockModifiedTimeChecker, mockBuildDependenciesGenerator}; + ClangBackEnd::BuildDependenciesProvider provider{mockBuildDependenciesStorage, + mockModifiedTimeChecker, + mockBuildDependenciesGenerator, + mockSqliteTransactionBackend}; ClangBackEnd::V2::ProjectPartContainer projectPart1{"ProjectPart1", {"--yi"}, - {{"YI","1"}}, + {{"YI", "1"}}, {"/yi"}, {1}, {2}}; ClangBackEnd::V2::ProjectPartContainer projectPart2{"ProjectPart2", {"--er"}, - {{"ER","2"}}, + {{"ER", "2"}}, {"/er"}, {1}, {2, 3, 4}}; - SourceEntries firstSources{{1, SourceType::UserInclude, 1}, {2, SourceType::UserInclude, 1}, {10, SourceType::UserInclude, 1}}; - SourceEntries secondSources{{1, SourceType::UserInclude, 1}, {3, SourceType::UserInclude, 1}, {8, SourceType::UserInclude, 1}}; - SourceEntries thirdSources{{4, SourceType::UserInclude, 1}, {8, SourceType::UserInclude, 1}, {10, SourceType::UserInclude, 1}}; + SourceEntries firstSources{{1, SourceType::UserInclude, 1}, + {2, SourceType::UserInclude, 1}, + {10, SourceType::UserInclude, 1}}; + SourceEntries secondSources{{1, SourceType::UserInclude, 1}, + {3, SourceType::UserInclude, 1}, + {8, SourceType::UserInclude, 1}}; + SourceEntries thirdSources{{4, SourceType::UserInclude, 1}, + {8, SourceType::UserInclude, 1}, + {10, SourceType::UserInclude, 1}}; UsedMacros firstUsedMacros{{"YI", 1}}; UsedMacros secondUsedMacros{{"LIANG", 2}, {"ER", 2}}; UsedMacros thirdUsedMacros{{"SAN", 10}}; - BuildDependency buildDependency{secondSources, {}}; + FilePathIds sourceFiles{1, 3, 8}; + ClangBackEnd::SourceDependencies sourceDependencies{{1, 3}, {1, 8}}; + ClangBackEnd::FileStatuses fileStatuses{{1, 21, 12, false}, + {3, 21, 12, false}, + {8, 21, 12, false}}; + BuildDependency buildDependency{ + secondSources, + secondUsedMacros, + sourceFiles, + sourceDependencies, + fileStatuses + }; }; TEST_F(BuildDependenciesProvider, CreateCallsFetchDependSourcesFromStorageIfTimeStampsAreUpToDate) { InSequence s; - EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq<Utils::SmallStringView>("ProjectPart1"))).WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); + EXPECT_CALL(mockBuildDependenciesStorage, + fetchDependSources({2}, TypedEq<Utils::SmallStringView>("ProjectPart1"))) + .WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(true)); EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1)).Times(0); + EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()).Times(0); + EXPECT_CALL(mockSqliteTransactionBackend, commit()).Times(0); + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); provider.create(projectPart1); } @@ -95,6 +125,7 @@ TEST_F(BuildDependenciesProvider, FetchDependSourcesFromStorage) ON_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq<Utils::SmallStringView>("ProjectPart2"))).WillByDefault(Return(firstSources)); ON_CALL(mockBuildDependenciesStorage, fetchDependSources({3}, TypedEq<Utils::SmallStringView>("ProjectPart2"))).WillByDefault(Return(secondSources)); ON_CALL(mockBuildDependenciesStorage, fetchDependSources({4}, TypedEq<Utils::SmallStringView>("ProjectPart2"))).WillByDefault(Return(thirdSources)); + ON_CALL(mockModifiedTimeChecker, isUpToDate(_)).WillByDefault(Return(true)); auto buildDependency = provider.create(projectPart2); @@ -106,9 +137,20 @@ TEST_F(BuildDependenciesProvider, CreateCallsFetchDependSourcesFromGeneratorIfTi { InSequence s; - EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq<Utils::SmallStringView>("ProjectPart1"))).WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); + EXPECT_CALL(mockBuildDependenciesStorage, + fetchDependSources({2}, TypedEq<Utils::SmallStringView>("ProjectPart1"))) + .WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(false)); - EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1)); + EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1)) + .WillOnce(Return(buildDependency)); + EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()); + EXPECT_CALL(mockBuildDependenciesStorage, updateSources(Eq(secondSources))); + EXPECT_CALL(mockBuildDependenciesStorage, insertFileStatuses(Eq(fileStatuses))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateUsedMacros(Eq(secondUsedMacros))); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); provider.create(projectPart1); } @@ -128,11 +170,15 @@ TEST_F(BuildDependenciesProvider, CreateCallsFetchUsedMacrosFromStorageIfTimeSta { InSequence s; + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq<Utils::SmallStringView>("ProjectPart1"))).WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(true)); + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros({1})); EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros({2})); EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros({10})); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); provider.create(projectPart1); } diff --git a/tests/unit/unittest/builddependenciesstorage-test.cpp b/tests/unit/unittest/builddependenciesstorage-test.cpp index 1100f1a634..77feb21bd7 100644 --- a/tests/unit/unittest/builddependenciesstorage-test.cpp +++ b/tests/unit/unittest/builddependenciesstorage-test.cpp @@ -51,21 +51,21 @@ class BuildDependenciesStorage : public testing::Test protected: NiceMock<MockSqliteDatabase> mockDatabase; Storage storage{mockDatabase}; - MockSqliteWriteStatement &insertIntoNewUsedMacrosStatement = storage.m_insertIntoNewUsedMacrosStatement; - MockSqliteWriteStatement &syncNewUsedMacrosStatement =storage.m_syncNewUsedMacrosStatement; - MockSqliteWriteStatement &deleteOutdatedUsedMacrosStatement = storage.m_deleteOutdatedUsedMacrosStatement; - MockSqliteWriteStatement &deleteNewUsedMacrosTableStatement = storage.m_deleteNewUsedMacrosTableStatement; - MockSqliteWriteStatement &insertFileStatuses = storage.m_insertFileStatusesStatement; - MockSqliteWriteStatement &insertIntoNewSourceDependenciesStatement = storage.m_insertIntoNewSourceDependenciesStatement; - MockSqliteWriteStatement &syncNewSourceDependenciesStatement = storage.m_syncNewSourceDependenciesStatement; - MockSqliteWriteStatement &deleteOutdatedSourceDependenciesStatement = storage.m_deleteOutdatedSourceDependenciesStatement; - MockSqliteWriteStatement &deleteNewSourceDependenciesStatement = storage.m_deleteNewSourceDependenciesStatement; - MockSqliteReadStatement &getLowestLastModifiedTimeOfDependencies = storage.m_getLowestLastModifiedTimeOfDependencies; - MockSqliteWriteStatement &updateBuildDependencyTimeStampStatement = storage.m_updateBuildDependencyTimeStampStatement; - MockSqliteWriteStatement &updateSourceTypeStatement = storage.m_updateSourceTypeStatement; - MockSqliteReadStatement &fetchSourceDependenciesStatement = storage.m_fetchSourceDependenciesStatement; - MockSqliteReadStatement &fetchProjectPartIdStatement = storage.m_fetchProjectPartIdStatement; - MockSqliteReadStatement &fetchUsedMacrosStatement = storage.m_fetchUsedMacrosStatement; + MockSqliteWriteStatement &insertIntoNewUsedMacrosStatement = storage.insertIntoNewUsedMacrosStatement; + MockSqliteWriteStatement &syncNewUsedMacrosStatement =storage.syncNewUsedMacrosStatement; + MockSqliteWriteStatement &deleteOutdatedUsedMacrosStatement = storage.deleteOutdatedUsedMacrosStatement; + MockSqliteWriteStatement &deleteNewUsedMacrosTableStatement = storage.deleteNewUsedMacrosTableStatement; + MockSqliteWriteStatement &insertFileStatuses = storage.insertFileStatusesStatement; + MockSqliteWriteStatement &insertIntoNewSourceDependenciesStatement = storage.insertIntoNewSourceDependenciesStatement; + MockSqliteWriteStatement &syncNewSourceDependenciesStatement = storage.syncNewSourceDependenciesStatement; + MockSqliteWriteStatement &deleteOutdatedSourceDependenciesStatement = storage.deleteOutdatedSourceDependenciesStatement; + MockSqliteWriteStatement &deleteNewSourceDependenciesStatement = storage.deleteNewSourceDependenciesStatement; + MockSqliteReadStatement &getLowestLastModifiedTimeOfDependencies = storage.getLowestLastModifiedTimeOfDependencies; + MockSqliteWriteStatement &updateBuildDependencyTimeStampStatement = storage.updateBuildDependencyTimeStampStatement; + MockSqliteWriteStatement &updateSourceTypeStatement = storage.updateSourceTypeStatement; + MockSqliteReadStatement &fetchSourceDependenciesStatement = storage.fetchSourceDependenciesStatement; + MockSqliteReadStatement &fetchProjectPartIdStatement = storage.fetchProjectPartIdStatement; + MockSqliteReadStatement &fetchUsedMacrosStatement = storage.fetchUsedMacrosStatement; }; TEST_F(BuildDependenciesStorage, ConvertStringsToJson) diff --git a/tests/unit/unittest/clang_dependency.pri b/tests/unit/unittest/clang_dependency.pri index 2c72feadff..62c798464b 100644 --- a/tests/unit/unittest/clang_dependency.pri +++ b/tests/unit/unittest/clang_dependency.pri @@ -22,6 +22,7 @@ include(../../../src/shared/clang/clang_defines.pri) !contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): QMAKE_RPATHDIR += $$LLVM_LIBDIR LLVM_CXXFLAGS ~= s,-g\d?, + QMAKE_CXXFLAGS_WARN_ON *= $$LLVM_CXXFLAGS_WARNINGS QMAKE_CXXFLAGS *= $$LLVM_CXXFLAGS DEFINES += CLANG_COMPILER_PATH=\"R\\\"xxx($$LLVM_BINDIR/clang)xxx\\\"\" diff --git a/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp b/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp index 4850c0f9b5..fb49a4c640 100644 --- a/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp +++ b/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp @@ -312,6 +312,14 @@ TEST_F(ClangCompletionContextAnalyzer, AfterOpeningParenthesis) ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClang, 0, 0, positionInText, true)); } +TEST_F(ClangCompletionContextAnalyzer, AfterOpeningBraceAndIdentifierOnNewLine) +{ + auto analyzer = runAnalyzer("if (1) {\n" + "cla@"); + + ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClang, -3, -3, positionInText, true)); +} + TEST_F(ClangCompletionContextAnalyzer, ArgumentOneAtSignal) { auto analyzer = runAnalyzer("SIGNAL(@"); diff --git a/tests/unit/unittest/compileroptionsbuilder-test.cpp b/tests/unit/unittest/compileroptionsbuilder-test.cpp index 662ff7787f..6b2d1af11e 100644 --- a/tests/unit/unittest/compileroptionsbuilder-test.cpp +++ b/tests/unit/unittest/compileroptionsbuilder-test.cpp @@ -230,6 +230,84 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderLinux) "-isystem", QDir::toNativeSeparators("/usr/include"))); } +TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderNoVersion) +{ + projectPart.headerPaths = {HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include", HeaderPathType::BuiltIn}, + HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++", HeaderPathType::BuiltIn}, + HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\i686-w64-mingw32", HeaderPathType::BuiltIn}, + HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\backward", HeaderPathType::BuiltIn} + }; + projectPart.toolChainTargetTriple = "x86_64-w64-windows-gnu"; + CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, + CppTools::UseSystemHeader::No, + CppTools::SkipBuiltIn::No, + CppTools::SkipLanguageDefines::Yes, + "7.0.0", + ""); + + compilerOptionsBuilder.addHeaderPathOptions(); + + ASSERT_THAT(compilerOptionsBuilder.options(), + ElementsAre("-nostdinc", + "-nostdlibinc", + "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include"), + "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++"), + "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\i686-w64-mingw32"), + "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\backward"), + "-isystem", QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""))); +} + +TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderAndroidClang) +{ + projectPart.headerPaths = { + HeaderPath{ + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android", + HeaderPathType::BuiltIn}, + HeaderPath{ + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++\\include", + HeaderPathType::BuiltIn}, + HeaderPath{ + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\android\\support\\include", + HeaderPathType::BuiltIn}, + HeaderPath{ + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++abi\\include", + HeaderPathType::BuiltIn}, + HeaderPath{"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include", + HeaderPathType::BuiltIn}}; + projectPart.toolChainTargetTriple = "i686-linux-android"; + CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, + CppTools::UseSystemHeader::No, + CppTools::SkipBuiltIn::No, + CppTools::SkipLanguageDefines::Yes, + "7.0.0", + ""); + + compilerOptionsBuilder.addHeaderPathOptions(); + + ASSERT_THAT( + compilerOptionsBuilder.options(), + ElementsAre( + "-nostdinc", + "-nostdlibinc", + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android"), + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++\\include"), + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\android\\support\\include"), + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++abi\\include"), + "-isystem", + QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""), + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include"))); +} + TEST_F(CompilerOptionsBuilder, NoPrecompiledHeader) { compilerOptionsBuilder.addPrecompiledHeaderOptions(CppTools::CompilerOptionsBuilder::PchUsage::None); diff --git a/tests/unit/unittest/data/highlightingmarks.cpp b/tests/unit/unittest/data/highlightingmarks.cpp index a5b6e85872..e1a48903ca 100644 --- a/tests/unit/unittest/data/highlightingmarks.cpp +++ b/tests/unit/unittest/data/highlightingmarks.cpp @@ -592,9 +592,9 @@ class WithVirtualFunctionDefined { namespace NFoo { namespace NBar { namespace NTest { class NamespaceTypeSpelling; } } } Undeclared u; - -#include "../../../../share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h" - +#define Q_PROPERTY(arg) static_assert("Q_PROPERTY", #arg); // Keep these in sync with wrappedQtHeaders/QtCore/qobjectdefs.h +#define SIGNAL(arg) #arg +#define SLOT(arg) #arg class Property { Q_PROPERTY(const volatile unsigned long long * prop READ getProp WRITE setProp NOTIFY propChanged) Q_PROPERTY(const QString str READ getStr) @@ -674,3 +674,15 @@ int signalSlotTest() { SIGNAL(something(QString (*func1)(QString))); 1 == 2; } + +class NonConstParameterConstructor +{ + NonConstParameterConstructor() = default; + NonConstParameterConstructor(NonConstParameterConstructor &buildDependenciesStorage); + + void Call() + { + NonConstParameterConstructor foo; + NonConstParameterConstructor bar(foo); + } +}; diff --git a/tests/unit/unittest/mockbuilddependenciesprovider.h b/tests/unit/unittest/mockbuilddependenciesprovider.h index 8bb048bd24..2a1fd8f93f 100644 --- a/tests/unit/unittest/mockbuilddependenciesprovider.h +++ b/tests/unit/unittest/mockbuilddependenciesprovider.h @@ -32,6 +32,7 @@ class MockBuildDependenciesProvider : public ClangBackEnd::BuildDependenciesProviderInterface { public: - MOCK_CONST_METHOD1(create, - ClangBackEnd::BuildDependency (const ClangBackEnd::V2::ProjectPartContainer &projectPart)); + MOCK_METHOD1( + create, + ClangBackEnd::BuildDependency(const ClangBackEnd::V2::ProjectPartContainer &projectPart)); }; diff --git a/tests/unit/unittest/tokenprocessor-test.cpp b/tests/unit/unittest/tokenprocessor-test.cpp index 2935a85381..f48d546cb1 100644 --- a/tests/unit/unittest/tokenprocessor-test.cpp +++ b/tests/unit/unittest/tokenprocessor-test.cpp @@ -1679,6 +1679,24 @@ TEST_F(TokenProcessor, QtOldStyleSignalFunctionPointerType) ASSERT_THAT(infos[10], HasOnlyType(HighlightingType::Type)); } +TEST_F(TokenProcessor, NonConstParameterConstructor) +{ + const auto infos = translationUnit.tokenInfosInRange(sourceRange(681, 90)); + + infos[1]; + + ASSERT_THAT(infos[4], Not(HasMixin(HighlightingType::OutputArgument))); +} + +TEST_F(TokenProcessor, DISABLED_NonConstArgumentConstructor) +{ + const auto infos = translationUnit.tokenInfosInRange(sourceRange(686, 47)); + + infos[2]; + + ASSERT_THAT(infos[3], HasMixin(HighlightingType::OutputArgument)); +} + Data *TokenProcessor::d; void TokenProcessor::SetUpTestCase() diff --git a/tests/unit/unittest/unittest.pro b/tests/unit/unittest/unittest.pro index 8c2c112230..c67771bd43 100644 --- a/tests/unit/unittest/unittest.pro +++ b/tests/unit/unittest/unittest.pro @@ -107,8 +107,7 @@ SOURCES += \ pchtaskgenerator-test.cpp \ compilationdatabaseutils-test.cpp \ builddependenciesprovider-test.cpp \ - builddependenciesstorage-test.cpp \ - builddependencycollector-test.cpp + builddependenciesstorage-test.cpp !isEmpty(LIBCLANG_LIBS) { SOURCES += \ @@ -185,7 +184,8 @@ SOURCES += \ symbolscollector-test.cpp \ symbolfinder-test.cpp \ testclangtool.cpp \ - usedmacrocollector-test.cpp + usedmacrocollector-test.cpp \ + builddependencycollector-test.cpp } exists($$GOOGLEBENCHMARK_DIR) { |