summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2022-06-22 14:31:33 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2022-06-24 10:05:54 +0000
commit224be9add898d60ec979efe4c0fd14312aeba858 (patch)
treeb5770770c4a2fdb418dd3c9635a130f8b6c20864 /tests
parente4d692a689a682a2b7476a9d5d4f115b81377b2b (diff)
downloadqt-creator-224be9add898d60ec979efe4c0fd14312aeba858.tar.gz
ClangTools: Move over a test from unittest
Change-Id: Id61a0bdb8e46ead4de8ad0298e62afb7b9fbcfb4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/unittest/CMakeLists.txt26
-rw-r--r--tests/unit/unittest/data/clangtools/CMakeLists.txt26
-rw-r--r--tests/unit/unittest/data/clangtools/clang-analyzer.dividezero.cpp5
-rw-r--r--tests/unit/unittest/data/clangtools/clang-analyzer.dividezero.yaml23
-rw-r--r--tests/unit/unittest/data/clangtools/clang-analyzer.dividezero_win.yaml23
-rw-r--r--tests/unit/unittest/data/clangtools/clazy.qgetenv.cpp8
-rw-r--r--tests/unit/unittest/data/clangtools/clazy.qgetenv.yaml17
-rw-r--r--tests/unit/unittest/data/clangtools/clazy.qgetenv_win.yaml17
-rw-r--r--tests/unit/unittest/data/clangtools/empty.yaml0
-rw-r--r--tests/unit/unittest/data/clangtools/main.cpp4
-rw-r--r--tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr.cpp2
-rw-r--r--tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr.yaml14
-rw-r--r--tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr_win.yaml14
-rw-r--r--tests/unit/unittest/readexporteddiagnostics-test.cpp350
-rw-r--r--tests/unit/unittest/unittest.qbs32
15 files changed, 0 insertions, 561 deletions
diff --git a/tests/unit/unittest/CMakeLists.txt b/tests/unit/unittest/CMakeLists.txt
index d51a8a56ad..e661df8237 100644
--- a/tests/unit/unittest/CMakeLists.txt
+++ b/tests/unit/unittest/CMakeLists.txt
@@ -142,11 +142,6 @@ add_custom_command(TARGET unittest POST_BUILD
)
extend_qtc_test(unittest
- SOURCES
- readexporteddiagnostics-test.cpp
-)
-
-extend_qtc_test(unittest
CONDITION TARGET GoogleBenchmark
DEPENDS GoogleBenchmark
SOURCES
@@ -327,27 +322,6 @@ endif()
extend_qtc_test(unittest DEPENDS Utils CPlusPlus)
-find_package(yaml-cpp QUIET MODULE)
-
-extend_qtc_test(unittest
- DEPENDS yaml-cpp
- DEFINES CLANGTOOLS_STATIC_LIBRARY
- SOURCES_PREFIX ../../../src/plugins/clangtools
- SOURCES
- clangtoolsdiagnostic.cpp
- clangtoolsdiagnostic.h
- clangtoolslogfilereader.cpp
- clangtoolslogfilereader.h
-)
-
-extend_qtc_test(unittest
- DEFINES DEBUGGER_STATIC_LIBRARY
- SOURCES_PREFIX ../../../src/plugins/debugger
- SOURCES
- analyzer/diagnosticlocation.cpp
- analyzer/diagnosticlocation.h
-)
-
extend_qtc_test(unittest
SOURCES_PREFIX ../../../src/plugins/coreplugin
DEFINES CORE_STATIC_LIBRARY
diff --git a/tests/unit/unittest/data/clangtools/CMakeLists.txt b/tests/unit/unittest/data/clangtools/CMakeLists.txt
deleted file mode 100644
index b445f81b7d..0000000000
--- a/tests/unit/unittest/data/clangtools/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-cmake_minimum_required(VERSION 3.5)
-
-project(clangtools LANGUAGES CXX)
-
-set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOUIC ON)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-
-set(CMAKE_CXX_STANDARD 11)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
-find_package(Qt5 COMPONENTS Widgets REQUIRED)
-
-add_executable(clangtools
- main.cpp
- clang-analyzer.dividezero.cpp
- clang.unused-parameter.cpp
- clang.unused-parameter.h
- clazy.qgetenv.cpp
- tidy.modernize-use-nullptr.cpp
-)
-
-target_link_libraries(clangtools PRIVATE Qt5::Widgets)
diff --git a/tests/unit/unittest/data/clangtools/clang-analyzer.dividezero.cpp b/tests/unit/unittest/data/clangtools/clang-analyzer.dividezero.cpp
deleted file mode 100644
index 5f623dc114..0000000000
--- a/tests/unit/unittest/data/clangtools/clang-analyzer.dividezero.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// clang-tidy -export-fixes=clang-analyzer.dividezero.yaml "-checks=-*,clang-analyzer-core.DivideZero" clang-analyzer.dividezero.cpp
-void test(int z) {
- if (z == 0)
- int x = 1 / z;
-}
diff --git a/tests/unit/unittest/data/clangtools/clang-analyzer.dividezero.yaml b/tests/unit/unittest/data/clangtools/clang-analyzer.dividezero.yaml
deleted file mode 100644
index d19c5887a9..0000000000
--- a/tests/unit/unittest/data/clangtools/clang-analyzer.dividezero.yaml
+++ /dev/null
@@ -1,23 +0,0 @@
----
-MainSourceFile: 'FILE_PATH'
-Diagnostics:
- - DiagnosticName: clang-analyzer-core.DivideZero
- DiagnosticMessage:
- Message: Division by zero
- FilePath: 'FILE_PATH'
- FileOffset: 180
- Replacements: []
- Notes:
- - Message: 'Assuming ''z'' is equal to 0'
- FilePath: 'FILE_PATH'
- FileOffset: 158
- Replacements: []
- - Message: Taking true branch
- FilePath: 'FILE_PATH'
- FileOffset: 154
- Replacements: []
- - Message: Division by zero
- FilePath: 'FILE_PATH'
- FileOffset: 180
- Replacements: []
-...
diff --git a/tests/unit/unittest/data/clangtools/clang-analyzer.dividezero_win.yaml b/tests/unit/unittest/data/clangtools/clang-analyzer.dividezero_win.yaml
deleted file mode 100644
index d54844d25c..0000000000
--- a/tests/unit/unittest/data/clangtools/clang-analyzer.dividezero_win.yaml
+++ /dev/null
@@ -1,23 +0,0 @@
----
-MainSourceFile: 'FILE_PATH'
-Diagnostics:
- - DiagnosticName: clang-analyzer-core.DivideZero
- DiagnosticMessage:
- Message: Division by zero
- FilePath: 'FILE_PATH'
- FileOffset: 183
- Replacements: []
- Notes:
- - Message: 'Assuming ''z'' is equal to 0'
- FilePath: 'FILE_PATH'
- FileOffset: 160
- Replacements: []
- - Message: Taking true branch
- FilePath: 'FILE_PATH'
- FileOffset: 156
- Replacements: []
- - Message: Division by zero
- FilePath: 'FILE_PATH'
- FileOffset: 183
- Replacements: []
-...
diff --git a/tests/unit/unittest/data/clangtools/clazy.qgetenv.cpp b/tests/unit/unittest/data/clangtools/clazy.qgetenv.cpp
deleted file mode 100644
index e04518821c..0000000000
--- a/tests/unit/unittest/data/clangtools/clazy.qgetenv.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// clazy-standalone -export-fixes=/tmp/clazy.qgetenv.yaml -checks=qgetenv clazy.qgetenv.cpp
-#include <QByteArray>
-#include <QtGlobal>
-
-void g()
-{
- qgetenv("Foo").isEmpty();
-}
diff --git a/tests/unit/unittest/data/clangtools/clazy.qgetenv.yaml b/tests/unit/unittest/data/clangtools/clazy.qgetenv.yaml
deleted file mode 100644
index a465a1ca63..0000000000
--- a/tests/unit/unittest/data/clangtools/clazy.qgetenv.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
----
-MainSourceFile: 'FILE_PATH'
-Diagnostics:
- - DiagnosticName: clazy-qgetenv
- Message: 'qgetenv().isEmpty() allocates. Use qEnvironmentVariableIsEmpty() instead'
- FileOffset: 150
- FilePath: 'FILE_PATH'
- Replacements:
- - FilePath: 'FILE_PATH'
- Offset: 150
- Length: 7
- ReplacementText: qEnvironmentVariableIsEmpty
- - FilePath: 'FILE_PATH'
- Offset: 163
- Length: 11
- ReplacementText: ')'
-...
diff --git a/tests/unit/unittest/data/clangtools/clazy.qgetenv_win.yaml b/tests/unit/unittest/data/clangtools/clazy.qgetenv_win.yaml
deleted file mode 100644
index c80a701373..0000000000
--- a/tests/unit/unittest/data/clangtools/clazy.qgetenv_win.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
----
-MainSourceFile: 'FILE_PATH'
-Diagnostics:
- - DiagnosticName: clazy-qgetenv
- Message: 'qgetenv().isEmpty() allocates. Use qEnvironmentVariableIsEmpty() instead'
- FileOffset: 156
- FilePath: 'FILE_PATH'
- Replacements:
- - FilePath: 'FILE_PATH'
- Offset: 156
- Length: 7
- ReplacementText: qEnvironmentVariableIsEmpty
- - FilePath: 'FILE_PATH'
- Offset: 169
- Length: 11
- ReplacementText: ')'
-...
diff --git a/tests/unit/unittest/data/clangtools/empty.yaml b/tests/unit/unittest/data/clangtools/empty.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/unit/unittest/data/clangtools/empty.yaml
+++ /dev/null
diff --git a/tests/unit/unittest/data/clangtools/main.cpp b/tests/unit/unittest/data/clangtools/main.cpp
deleted file mode 100644
index df38a77648..0000000000
--- a/tests/unit/unittest/data/clangtools/main.cpp
+++ /dev/null
@@ -1,4 +0,0 @@
-int main(int, char *[])
-{
- return 0;
-}
diff --git a/tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr.cpp b/tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr.cpp
deleted file mode 100644
index fedae86330..0000000000
--- a/tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-// clang-tidy -export-fixes=tidy.modernize-use-nullptr.yaml "-checks=-*,modernize-use-nullptr" tidy.modernize-use-nullptr.cpp
-int *ret_ptr() { return 0; }
diff --git a/tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr.yaml b/tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr.yaml
deleted file mode 100644
index 7724d3bdfc..0000000000
--- a/tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
----
-MainSourceFile: 'FILE_PATH'
-Diagnostics:
- - DiagnosticName: modernize-use-nullptr
- DiagnosticMessage:
- Message: use nullptr
- FilePath: 'FILE_PATH'
- FileOffset: 150
- Replacements:
- - FilePath: 'FILE_PATH'
- Offset: 150
- Length: 1
- ReplacementText: nullptr
-...
diff --git a/tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr_win.yaml b/tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr_win.yaml
deleted file mode 100644
index c6bb6766ad..0000000000
--- a/tests/unit/unittest/data/clangtools/tidy.modernize-use-nullptr_win.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
----
-MainSourceFile: 'FILE_PATH'
-Diagnostics:
- - DiagnosticName: modernize-use-nullptr
- DiagnosticMessage:
- Message: use nullptr
- FilePath: 'FILE_PATH'
- FileOffset: 151
- Replacements:
- - FilePath: 'FILE_PATH'
- Offset: 151
- Length: 1
- ReplacementText: nullptr
-...
diff --git a/tests/unit/unittest/readexporteddiagnostics-test.cpp b/tests/unit/unittest/readexporteddiagnostics-test.cpp
deleted file mode 100644
index dcd0a00ee7..0000000000
--- a/tests/unit/unittest/readexporteddiagnostics-test.cpp
+++ /dev/null
@@ -1,350 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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 <clangtools/clangtoolslogfilereader.h>
-
-#include <utils/fileutils.h>
-#include <utils/qtcassert.h>
-
-#define TESTDATA TESTDATA_DIR "/clangtools/"
-
-using namespace ClangTools::Internal;
-using Debugger::DiagnosticLocation;
-
-namespace {
-
-class ReadExportedDiagnostics : public ::testing::Test
-{
-protected:
- void SetUp() override
- {
- ASSERT_TRUE(temporaryDir.isValid());
- }
-
- // Replace FILE_PATH with a real absolute file path in the *.yaml files.
- QString createFile(const QString &yamlFilePath, const QString &filePathToInject)
- {
- QTC_ASSERT(QDir::isAbsolutePath(filePathToInject), return QString());
- const Utils::FilePath newFileName = temporaryDir.filePath(QFileInfo(yamlFilePath).fileName());
-
- Utils::FileReader reader;
- if (QTC_GUARD(reader.fetch(Utils::FilePath::fromString(yamlFilePath),
- QIODevice::ReadOnly | QIODevice::Text))) {
- QByteArray contents = reader.data();
- contents.replace("FILE_PATH", filePathToInject.toLocal8Bit());
-
- Utils::FileSaver fileSaver(newFileName, QIODevice::WriteOnly | QIODevice::Text);
- QTC_CHECK(fileSaver.write(contents));
- QTC_CHECK(fileSaver.finalize());
- }
-
- return newFileName.toString();
- }
-
-protected:
- QString errorMessage;
- Utils::TemporaryDirectory temporaryDir{"clangtools-tests-XXXXXX"};
-};
-
-TEST_F(ReadExportedDiagnostics, NotExistingFile)
-{
- Diagnostics diags = readExportedDiagnostics("notExistingFile.yaml",
- {},
- &errorMessage);
-
- ASSERT_THAT(diags, IsEmpty());
- ASSERT_FALSE(errorMessage.isEmpty());
-}
-
-TEST_F(ReadExportedDiagnostics, EmptyFile)
-{
- Diagnostics diags = readExportedDiagnostics(TESTDATA "empty.yaml",
- {},
- &errorMessage);
-
- ASSERT_THAT(diags, IsEmpty());
- ASSERT_TRUE(errorMessage.isEmpty());
-}
-
-TEST_F(ReadExportedDiagnostics, UnexpectedFileContents)
-{
- const QString sourceFile = TESTDATA "tidy.modernize-use-nullptr.cpp";
-
- Diagnostics diags = readExportedDiagnostics(Utils::FilePath::fromString(sourceFile),
- {},
- &errorMessage);
-
- ASSERT_FALSE(errorMessage.isEmpty());
- ASSERT_THAT(diags, IsEmpty());
-}
-
-static QString appendYamlSuffix(const char *filePathFragment)
-{
- const QString yamlSuffix = QLatin1String(Utils::HostOsInfo::isWindowsHost()
- ? "_win.yaml" : ".yaml");
- return filePathFragment + yamlSuffix;
-}
-
-TEST_F(ReadExportedDiagnostics, Tidy)
-{
- const Utils::FilePath sourceFile = Utils::FilePath::fromString(
- TESTDATA "tidy.modernize-use-nullptr.cpp");
- const QString exportedFile = createFile(appendYamlSuffix(TESTDATA "tidy.modernize-use-nullptr"),
- sourceFile.toString());
- Diagnostic expectedDiag;
- expectedDiag.name = "modernize-use-nullptr";
- expectedDiag.location = {sourceFile, 2, 25};
- expectedDiag.description = "use nullptr [modernize-use-nullptr]";
- expectedDiag.type = "warning";
- expectedDiag.hasFixits = true;
- expectedDiag.explainingSteps = {
- ExplainingStep{"nullptr",
- expectedDiag.location,
- {expectedDiag.location, {sourceFile, 2, 26}},
- true}};
-
- Diagnostics diags = readExportedDiagnostics(Utils::FilePath::fromString(exportedFile),
- {},
- &errorMessage);
-
- ASSERT_TRUE(errorMessage.isEmpty());
- ASSERT_THAT(diags, ElementsAre(expectedDiag));
-}
-
-TEST_F(ReadExportedDiagnostics, AcceptDiagsFromFilePaths_None)
-{
- const QString sourceFile = TESTDATA "tidy.modernize-use-nullptr.cpp";
- const QString exportedFile = createFile(TESTDATA "tidy.modernize-use-nullptr.yaml", sourceFile);
- const auto acceptNone = [](const Utils::FilePath &) { return false; };
-
- Diagnostics diags = readExportedDiagnostics(Utils::FilePath::fromString(exportedFile),
- acceptNone,
- &errorMessage);
-
- ASSERT_TRUE(errorMessage.isEmpty());
- ASSERT_THAT(diags, IsEmpty());
-}
-
-// Diagnostics from clang (static) analyzer passed through via clang-tidy
-TEST_F(ReadExportedDiagnostics, Tidy_ClangAnalyzer)
-{
- const Utils::FilePath sourceFile = Utils::FilePath::fromString(TESTDATA
- "clang-analyzer.dividezero.cpp");
- const QString exportedFile = createFile(appendYamlSuffix(TESTDATA "clang-analyzer.dividezero"),
- sourceFile.toString());
- Diagnostic expectedDiag;
- expectedDiag.name = "clang-analyzer-core.DivideZero";
- expectedDiag.location = {sourceFile, 4, 15};
- expectedDiag.description = "Division by zero [clang-analyzer-core.DivideZero]";
- expectedDiag.type = "warning";
- expectedDiag.hasFixits = false;
- expectedDiag.explainingSteps = {
- ExplainingStep{"Assuming 'z' is equal to 0",
- {sourceFile, 3, 7},
- {},
- false,
- },
- ExplainingStep{"Taking true branch",
- {sourceFile, 3, 3},
- {},
- false,
- },
- ExplainingStep{"Division by zero",
- {sourceFile, 4, 15},
- {},
- false,
- },
- };
-
- Diagnostics diags = readExportedDiagnostics(Utils::FilePath::fromString(exportedFile),
- {},
- &errorMessage);
-
- ASSERT_TRUE(errorMessage.isEmpty());
- ASSERT_THAT(diags, ElementsAre(expectedDiag));
-}
-
-TEST_F(ReadExportedDiagnostics, Clazy)
-{
- const Utils::FilePath sourceFile = Utils::FilePath::fromString(TESTDATA "clazy.qgetenv.cpp");
- const QString exportedFile = createFile(appendYamlSuffix(TESTDATA "clazy.qgetenv"),
- sourceFile.toString());
- Diagnostic expectedDiag;
- expectedDiag.name = "clazy-qgetenv";
- expectedDiag.location = {sourceFile, 7, 5};
- expectedDiag.description = "qgetenv().isEmpty() allocates. Use qEnvironmentVariableIsEmpty() instead [clazy-qgetenv]";
- expectedDiag.type = "warning";
- expectedDiag.hasFixits = true;
- expectedDiag.explainingSteps = {
- ExplainingStep{"qEnvironmentVariableIsEmpty",
- expectedDiag.location,
- {expectedDiag.location, {sourceFile, 7, 12}},
- true
- },
- ExplainingStep{")",
- {sourceFile, 7, 18},
- {{sourceFile, 7, 18}, {sourceFile, 7, 29}},
- true},
- };
-
- Diagnostics diags = readExportedDiagnostics(Utils::FilePath::fromString(exportedFile),
- {},
- &errorMessage);
-
- ASSERT_TRUE(errorMessage.isEmpty());
- ASSERT_THAT(diags, ElementsAre(expectedDiag));
-}
-
-class ByteOffsetInUtf8TextToLineColumn : public ::testing::Test
-{
-protected:
- const char *empty = "";
- const char *asciiWord = "FOO";
- const char *asciiMultiLine = "FOO\nBAR";
- const char *asciiMultiLine_dos = "FOO\r\nBAR";
- const char *asciiEmptyMultiLine = "\n\n";
- // U+00FC - 2 code units in UTF8, 1 in UTF16 - LATIN SMALL LETTER U WITH DIAERESIS
- // U+4E8C - 3 code units in UTF8, 1 in UTF16 - CJK UNIFIED IDEOGRAPH-4E8C
- // U+10302 - 4 code units in UTF8, 2 in UTF16 - OLD ITALIC LETTER KE
- const char *nonAsciiMultiLine = "\xc3\xbc" "\n"
- "\xe4\xba\x8c" "\n"
- "\xf0\x90\x8c\x82" "X";
-
- // Convenience
- const char *text = nullptr;
-};
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, InvalidText)
-{
- ASSERT_FALSE(byteOffsetInUtf8TextToLineColumn(nullptr, 0));
-}
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, InvalidOffset_EmptyInput)
-{
- ASSERT_FALSE(byteOffsetInUtf8TextToLineColumn(empty, 0));
-}
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, InvalidOffset_Before)
-{
- ASSERT_FALSE(byteOffsetInUtf8TextToLineColumn(asciiWord, -1));
-}
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, InvalidOffset_After)
-{
- ASSERT_FALSE(byteOffsetInUtf8TextToLineColumn(asciiWord, 3));
-}
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, InvalidOffset_NotFirstByteOfMultiByte)
-{
- ASSERT_FALSE(byteOffsetInUtf8TextToLineColumn(nonAsciiMultiLine, 1));
-}
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, StartOfFirstLine)
-{
- auto info = byteOffsetInUtf8TextToLineColumn(asciiWord, 0);
-
- ASSERT_TRUE(info);
- ASSERT_THAT(info->line, Eq(1));
- ASSERT_THAT(info->column, Eq(1));
-}
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, EndOfFirstLine)
-{
- auto info = byteOffsetInUtf8TextToLineColumn(asciiWord, 2);
-
- ASSERT_TRUE(info);
- ASSERT_THAT(info->line, Eq(1));
- ASSERT_THAT(info->column, Eq(3));
-}
-
-// The invocation
-//
-// clang-tidy "-checks=-*,readability-braces-around-statements" /path/to/file
-//
-// for the code
-//
-// void f(bool b)
-// {
-// if (b)
-// f(b);
-// }
-//
-// emits
-//
-// 3:11: warning: statement should be inside braces [readability-braces-around-statements]
-//
-// The new line in the if-line is considered as column 11, which is normally not visible in the
-// editor.
-TEST_F(ByteOffsetInUtf8TextToLineColumn, OffsetPointingToLineSeparator_unix)
-{
- auto info = byteOffsetInUtf8TextToLineColumn(asciiMultiLine, 3);
-
- ASSERT_TRUE(info);
- ASSERT_THAT(info->line, Eq(1));
- ASSERT_THAT(info->column, Eq(4));
-}
-
-// For a file with dos style line endings ("\r\n"), clang-tidy points to '\r'.
-TEST_F(ByteOffsetInUtf8TextToLineColumn, OffsetPointingToLineSeparator_dos)
-{
- auto info = byteOffsetInUtf8TextToLineColumn(asciiMultiLine_dos, 3);
-
- ASSERT_TRUE(info);
- ASSERT_THAT(info->line, Eq(1));
- ASSERT_THAT(info->column, Eq(4));
-}
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, StartOfSecondLine)
-{
- auto info = byteOffsetInUtf8TextToLineColumn(asciiMultiLine, 4);
-
- ASSERT_TRUE(info);
- ASSERT_THAT(info->line, Eq(2));
- ASSERT_THAT(info->column, Eq(1));
-}
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, MultiByteCodePoint1)
-{
- auto info = byteOffsetInUtf8TextToLineColumn(nonAsciiMultiLine, 3);
-
- ASSERT_TRUE(info);
- ASSERT_THAT(info->line, Eq(2));
- ASSERT_THAT(info->column, Eq(1));
-}
-
-TEST_F(ByteOffsetInUtf8TextToLineColumn, MultiByteCodePoint2)
-{
- auto info = byteOffsetInUtf8TextToLineColumn(nonAsciiMultiLine, 11);
-
- ASSERT_TRUE(info);
- ASSERT_THAT(info->line, Eq(3));
- ASSERT_THAT(info->column, Eq(2));
-}
-
-} // namespace
-
-#undef TESTDATA
diff --git a/tests/unit/unittest/unittest.qbs b/tests/unit/unittest/unittest.qbs
index d53e858b5d..21fa47cb43 100644
--- a/tests/unit/unittest/unittest.qbs
+++ b/tests/unit/unittest/unittest.qbs
@@ -23,7 +23,6 @@ Project {
Depends { name: "sqlite_sources" }
Depends { name: "Core" }
Depends { name: "CPlusPlus" }
- Depends { name: "yaml-cpp" }
Depends { name: "Qt"; submodules: ["network", "widgets", "testlib"] }
@@ -40,9 +39,7 @@ Project {
"QT_RESTRICTED_CAST_FROM_ASCII",
"QT_USE_FAST_OPERATOR_PLUS",
"QT_USE_FAST_CONCATENATION",
- "CLANGTOOLS_STATIC_LIBRARY",
"CPPEDITOR_STATIC_LIBRARY",
- "DEBUGGER_STATIC_LIBRARY",
"UNIT_TESTS",
"DONT_CHECK_MESSAGE_COUNTER",
'QTC_RESOURCE_DIR="' + path + "/../../../share/qtcreator" + '"',
@@ -173,14 +170,6 @@ Project {
]
Group {
- name: "libclang tests"
- condition: libclang.present && (!qbs.targetOS.contains("windows") || libclang.llvmBuildModeMatches)
- files: [
- "readexporteddiagnostics-test.cpp",
- ]
- }
-
- Group {
name: "benchmark test"
condition: benchmark.present
files: "smallstring-benchmark.cpp"
@@ -203,26 +192,5 @@ Project {
"cppprojectfile.h",
]
}
-
- Group {
- name: "sources from clangtools"
- condition: libclang.present
- prefix: "../../../src/plugins/clangtools/"
- files: [
- "clangtoolsdiagnostic.cpp",
- "clangtoolsdiagnostic.h",
- "clangtoolslogfilereader.cpp",
- "clangtoolslogfilereader.h",
- ]
- }
-
- Group {
- name: "sources from Debugger"
- prefix: "../../../src/plugins/debugger/analyzer/"
- files: [
- "diagnosticlocation.cpp",
- "diagnosticlocation.h",
- ]
- }
}
}