diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2022-06-22 14:42:54 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2022-06-24 11:01:01 +0000 |
commit | e2b99e6b31061edd4c9a78d3a89377f03d244228 (patch) | |
tree | ec3f54162b60ea05788256e955ecaa8fcfa5d5ea /tests | |
parent | 224be9add898d60ec979efe4c0fd14312aeba858 (diff) | |
download | qt-creator-e2b99e6b31061edd4c9a78d3a89377f03d244228.tar.gz |
Unit test: Remove libclang test remains
Change-Id: Ifa2cd2727ecf80d3b29dc2bc2a10af11baa2f1dc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests')
68 files changed, 12 insertions, 2355 deletions
diff --git a/tests/unit/unittest/CMakeLists.txt b/tests/unit/unittest/CMakeLists.txt index e661df8237..a0b39262ef 100644 --- a/tests/unit/unittest/CMakeLists.txt +++ b/tests/unit/unittest/CMakeLists.txt @@ -60,7 +60,6 @@ add_qtc_test(unittest GTEST processevents-utilities.cpp processevents-utilities.h sizedarray-test.cpp smallstring-test.cpp - sourcerangecontainer-matcher.h spydummy.cpp spydummy.h sqlitealgorithms-test.cpp sqliteindex-test.cpp @@ -331,13 +330,6 @@ extend_qtc_test(unittest locator/ilocatorfilter.cpp locator/ilocatorfilter.h ) -extend_qtc_test(unittest - SOURCES_PREFIX ../../../src/plugins/cppeditor - DEFINES CPPEDITOR_STATIC_LIBRARY - SOURCES - cppprojectfile.cpp cppprojectfile.h -) - get_filename_component( QMLDOM_STANDALONE_CMAKELISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../qmldom_standalone/src/qmldom/standalone/" diff --git a/tests/unit/unittest/data/complete_arrow.cpp b/tests/unit/unittest/data/complete_arrow.cpp deleted file mode 100644 index 2d969e2bfb..0000000000 --- a/tests/unit/unittest/data/complete_arrow.cpp +++ /dev/null @@ -1,6 +0,0 @@ -struct Foo { int member; }; - -void g(Foo *foo) -{ - foo-> -} diff --git a/tests/unit/unittest/data/complete_completer_main.cpp b/tests/unit/unittest/data/complete_completer_main.cpp deleted file mode 100644 index 877ce23d28..0000000000 --- a/tests/unit/unittest/data/complete_completer_main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "complete_forwarding_header_1.h" - -void Function() -{ - -} - -class Foo; -void FunctionWithArguments(int i, char *c, const Foo &ref) -{ - -} - -void SavedFunction() -{ - -} - - - - - - - -void f() -{ - -} diff --git a/tests/unit/unittest/data/complete_completer_main_unsaved.cpp b/tests/unit/unittest/data/complete_completer_main_unsaved.cpp deleted file mode 100644 index 38af12b858..0000000000 --- a/tests/unit/unittest/data/complete_completer_main_unsaved.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "complete_forwarding_header_2.h" - -void Function() -{ - -} - -class Foo; -void FunctionWithArguments(int i, char *c, const Foo &ref) -{ - -} - -void UnsavedFunction() -{ - -} - -#define Macro - -int GlobalVariableInUnsavedFile; - -void f() -{ - int VariableInUnsavedFile; - - -} diff --git a/tests/unit/unittest/data/complete_extractor_brief_comment.cpp b/tests/unit/unittest/data/complete_extractor_brief_comment.cpp deleted file mode 100644 index 89ffa79e42..0000000000 --- a/tests/unit/unittest/data/complete_extractor_brief_comment.cpp +++ /dev/null @@ -1,11 +0,0 @@ -/** - * A brief comment - */ -void BriefComment() -{ - -} - -void f() { - -} diff --git a/tests/unit/unittest/data/complete_extractor_class.cpp b/tests/unit/unittest/data/complete_extractor_class.cpp deleted file mode 100644 index 218b5fbe25..0000000000 --- a/tests/unit/unittest/data/complete_extractor_class.cpp +++ /dev/null @@ -1,21 +0,0 @@ -class Class {}; -struct Struct{}; -union Union{}; -typedef Class TypeDef; -using UsingClass = Class; -template<class T> class TemplateClass{}; -template<class T> class ClassTemplatePartialSpecialization; -template<class T> class ClassTemplatePartialSpecialization<T*>; - - - - - - - - -template<class TemplateTypeParameter, template<class> class TemplateTemplateParameter> -void function() -{ - -} diff --git a/tests/unit/unittest/data/complete_extractor_constructor.cpp b/tests/unit/unittest/data/complete_extractor_constructor.cpp deleted file mode 100644 index e28ccaea82..0000000000 --- a/tests/unit/unittest/data/complete_extractor_constructor.cpp +++ /dev/null @@ -1,22 +0,0 @@ -class Constructor { - Constructor(); - ~Constructor(); - - - - - - - - - - - - - - - void function() - { - - } -}; diff --git a/tests/unit/unittest/data/complete_extractor_constructorMemberInitialization.cpp b/tests/unit/unittest/data/complete_extractor_constructorMemberInitialization.cpp deleted file mode 100644 index bbbe8ccfb8..0000000000 --- a/tests/unit/unittest/data/complete_extractor_constructorMemberInitialization.cpp +++ /dev/null @@ -1,5 +0,0 @@ -class Constructor { - Constructor() : {} - - int member; -}; diff --git a/tests/unit/unittest/data/complete_extractor_enumeration.cpp b/tests/unit/unittest/data/complete_extractor_enumeration.cpp deleted file mode 100644 index 79973a616b..0000000000 --- a/tests/unit/unittest/data/complete_extractor_enumeration.cpp +++ /dev/null @@ -1,22 +0,0 @@ -enum Enumeration { - Enumerator -}; - - - - - - - - - - - - - - -void function() -{ - -} - diff --git a/tests/unit/unittest/data/complete_extractor_function.cpp b/tests/unit/unittest/data/complete_extractor_function.cpp deleted file mode 100644 index 6a3d1bf73a..0000000000 --- a/tests/unit/unittest/data/complete_extractor_function.cpp +++ /dev/null @@ -1,22 +0,0 @@ -void Function(); -template<class T> void TemplateFunction(); -void FunctionWithOptional(int x, char y = 1, int z = 5); -#define FunctionMacro(X, Y) X + Y - -class base { - void NotAccessibleFunction(); -}; -class Class : public base { - void Method(); - void MethodWithParameters(int x = 30); - __attribute__((annotate("qt_slot"))) void Slot(); - __attribute__((annotate("qt_signal"))) void Signal(); - __attribute__ ((deprecated)) void DeprecatedFunction(); - void NotAvailableFunction() = delete; - -public: - void function() - { - - } -}; diff --git a/tests/unit/unittest/data/complete_extractor_function_unsaved.cpp b/tests/unit/unittest/data/complete_extractor_function_unsaved.cpp deleted file mode 100644 index adab53527b..0000000000 --- a/tests/unit/unittest/data/complete_extractor_function_unsaved.cpp +++ /dev/null @@ -1,22 +0,0 @@ -void Function(); -template<class T> void TemplateFunction(); - -#define FunctionMacro(X, Y) X + Y - -class base { - void NotAccessibleFunction(); -}; -class Class : public base { - void Method2(); - void MethodWithParameters(int x = 30); - __attribute__((annotate("qt_slot"))) void Slot(); - __attribute__((annotate("qt_signal"))) void Signal(); - __attribute__ ((deprecated)) void DeprecatedFunction(); - void NotAvailableFunction() = delete; - -public: - void function() - { - - } -}; diff --git a/tests/unit/unittest/data/complete_extractor_function_unsaved_2.cpp b/tests/unit/unittest/data/complete_extractor_function_unsaved_2.cpp deleted file mode 100644 index 08153184f4..0000000000 --- a/tests/unit/unittest/data/complete_extractor_function_unsaved_2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -void Function(); -template<class T> void TemplateFunction(); - -#define FunctionMacro(X, Y) X + Y - -class base { - void NotAccessibleFunction(); -}; -class Class : public base { - void Method3(); - void MethodWithParameters(int x = 30); - __attribute__((annotate("qt_slot"))) void Slot(); - __attribute__((annotate("qt_signal"))) void Signal(); - __attribute__ ((deprecated)) void DeprecatedFunction(); - void NotAvailableFunction() = delete; - -public: - void function() - { - - } -}; diff --git a/tests/unit/unittest/data/complete_extractor_functionoverload.cpp b/tests/unit/unittest/data/complete_extractor_functionoverload.cpp deleted file mode 100644 index fa447158f4..0000000000 --- a/tests/unit/unittest/data/complete_extractor_functionoverload.cpp +++ /dev/null @@ -1,9 +0,0 @@ -struct Foo { - Foo(const Foo &foo); - Foo(char c); -}; - -void f() -{ - Foo foo( -} diff --git a/tests/unit/unittest/data/complete_extractor_namespace.cpp b/tests/unit/unittest/data/complete_extractor_namespace.cpp deleted file mode 100644 index 46d273da9d..0000000000 --- a/tests/unit/unittest/data/complete_extractor_namespace.cpp +++ /dev/null @@ -1,22 +0,0 @@ -namespace Namespace {} -namespace NamespaceAlias = Namespace; - - - - - - - - - - - - - - - -void function() -{ - -} - diff --git a/tests/unit/unittest/data/complete_extractor_private_function_definition.cpp b/tests/unit/unittest/data/complete_extractor_private_function_definition.cpp deleted file mode 100644 index c2dd9e3dab..0000000000 --- a/tests/unit/unittest/data/complete_extractor_private_function_definition.cpp +++ /dev/null @@ -1,5 +0,0 @@ -class Foo { - void method(); -}; - -void Foo::m diff --git a/tests/unit/unittest/data/complete_extractor_variable.cpp b/tests/unit/unittest/data/complete_extractor_variable.cpp deleted file mode 100644 index e8a67f9c6c..0000000000 --- a/tests/unit/unittest/data/complete_extractor_variable.cpp +++ /dev/null @@ -1,36 +0,0 @@ -void function(int Parameter) -{ - int Var = 0; - -} - -void function2() -{ - int Var = 0; - auto Lambda = [&Var]() - { - - }; -} - -class Class { - int Field; - - void function() { - - } -}; - -template <int NonTypeTemplateParameter> -void function3() {} - -#define MacroDefinition - - -void function4() -{ -#ifdef ArgumentDefinition - int ArgumentDefinitionVariable; -#endif - -} diff --git a/tests/unit/unittest/data/complete_forwarding_header_1.h b/tests/unit/unittest/data/complete_forwarding_header_1.h deleted file mode 100644 index ebd822c41b..0000000000 --- a/tests/unit/unittest/data/complete_forwarding_header_1.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include <complete_target_header.h> diff --git a/tests/unit/unittest/data/complete_forwarding_header_2.h b/tests/unit/unittest/data/complete_forwarding_header_2.h deleted file mode 100644 index ebd822c41b..0000000000 --- a/tests/unit/unittest/data/complete_forwarding_header_2.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include <complete_target_header.h> diff --git a/tests/unit/unittest/data/complete_smartpointer.cpp b/tests/unit/unittest/data/complete_smartpointer.cpp deleted file mode 100644 index a6e7d73a58..0000000000 --- a/tests/unit/unittest/data/complete_smartpointer.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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. -** -****************************************************************************/ -namespace std { -template<class Type, class... Args> -class unique_ptr {}; - -template<class Type, class... Args> -class shared_ptr { -public: - void reset(); - Type *operator->(); -}; - -template<class Type, class... Args> -unique_ptr<Type> make_unique(Args&&... args); - -template<class Type, class... Args> -shared_ptr<Type> make_shared(Args&&... args); -} // namespace std - -template<class Type> -class QSharedPointer -{ -public: - template<class... Args> - static QSharedPointer<Type> create(Args&&... args); -}; - -class Bar -{ -public: - Bar(); - Bar(int, int); -}; -void f2() -{ - std::unique_ptr<Bar> bar = std::make_unique<Bar>(); - std::shared_ptr<Bar> bar2 = std::make_shared<Bar>(); - QSharedPointer<Bar> bar3 = QSharedPointer<Bar>::create(); - bar2-> -} diff --git a/tests/unit/unittest/data/complete_target_header.h b/tests/unit/unittest/data/complete_target_header.h deleted file mode 100644 index 67bc13701d..0000000000 --- a/tests/unit/unittest/data/complete_target_header.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -void FunctionInIncludedHeader(); diff --git a/tests/unit/unittest/data/complete_target_header_changed.h b/tests/unit/unittest/data/complete_target_header_changed.h deleted file mode 100644 index be7ac4e532..0000000000 --- a/tests/unit/unittest/data/complete_target_header_changed.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -void FunctionInIncludedHeader(); -void FunctionInIncludedHeaderChanged(); diff --git a/tests/unit/unittest/data/complete_target_header_unsaved.h b/tests/unit/unittest/data/complete_target_header_unsaved.h deleted file mode 100644 index 7007f9b5fe..0000000000 --- a/tests/unit/unittest/data/complete_target_header_unsaved.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -void FunctionInIncludedHeader(); -void FunctionInIncludedHeaderUnsaved(); diff --git a/tests/unit/unittest/data/complete_testfile_1.cpp b/tests/unit/unittest/data/complete_testfile_1.cpp deleted file mode 100644 index d53b0a1e98..0000000000 --- a/tests/unit/unittest/data/complete_testfile_1.cpp +++ /dev/null @@ -1,45 +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. -** -****************************************************************************/ - -void function() -{ - -} - -class Foo; -void functionWithArguments(int i, char *c, const Foo &ref) -{ - -} - -void otherFunction() -{ - -} - -void f() -{ - -} diff --git a/tests/unit/unittest/data/complete_translationunit_parse_error.cpp b/tests/unit/unittest/data/complete_translationunit_parse_error.cpp deleted file mode 100644 index 288cef2a33..0000000000 --- a/tests/unit/unittest/data/complete_translationunit_parse_error.cpp +++ /dev/null @@ -1,2 +0,0 @@ -NAMESPACE { - diff --git a/tests/unit/unittest/data/complete_withDotArrowCorrectionForForwardDeclaredClassPointer.cpp b/tests/unit/unittest/data/complete_withDotArrowCorrectionForForwardDeclaredClassPointer.cpp deleted file mode 100644 index 46e7e9d08b..0000000000 --- a/tests/unit/unittest/data/complete_withDotArrowCorrectionForForwardDeclaredClassPointer.cpp +++ /dev/null @@ -1,6 +0,0 @@ -struct Bar; - -void g(Bar *bar) -{ - bar. -} diff --git a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointer.cpp b/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointer.cpp deleted file mode 100644 index 9f8d3645b2..0000000000 --- a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointer.cpp +++ /dev/null @@ -1,6 +0,0 @@ -struct Foo { int member; }; - -void g(Foo *foo) -{ - foo. -} diff --git a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointerInitial.cpp b/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointerInitial.cpp deleted file mode 100644 index 0472cfacaa..0000000000 --- a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointerInitial.cpp +++ /dev/null @@ -1,6 +0,0 @@ -struct Foo { int member; }; - -void g(Foo *foo) -{ - -} diff --git a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointerUpdated.cpp b/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointerUpdated.cpp deleted file mode 100644 index 9f8d3645b2..0000000000 --- a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointerUpdated.cpp +++ /dev/null @@ -1,6 +0,0 @@ -struct Foo { int member; }; - -void g(Foo *foo) -{ - foo. -} diff --git a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointer_afterTyping.cpp b/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointer_afterTyping.cpp deleted file mode 100644 index 9f8d3645b2..0000000000 --- a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointer_afterTyping.cpp +++ /dev/null @@ -1,6 +0,0 @@ -struct Foo { int member; }; - -void g(Foo *foo) -{ - foo. -} diff --git a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointer_beforeTyping.cpp b/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointer_beforeTyping.cpp deleted file mode 100644 index 0472cfacaa..0000000000 --- a/tests/unit/unittest/data/complete_withDotArrowCorrectionForPointer_beforeTyping.cpp +++ /dev/null @@ -1,6 +0,0 @@ -struct Foo { int member; }; - -void g(Foo *foo) -{ - -} diff --git a/tests/unit/unittest/data/complete_withGlobalCompletionAfterForwardDeclaredClassPointer.cpp b/tests/unit/unittest/data/complete_withGlobalCompletionAfterForwardDeclaredClassPointer.cpp deleted file mode 100644 index 66ef372934..0000000000 --- a/tests/unit/unittest/data/complete_withGlobalCompletionAfterForwardDeclaredClassPointer.cpp +++ /dev/null @@ -1,7 +0,0 @@ -struct Bar; - -void g(Bar *bar) -{ - bar-> - // white space preserver -} diff --git a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForArrowDot.cpp b/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForArrowDot.cpp deleted file mode 100644 index 304c17c05b..0000000000 --- a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForArrowDot.cpp +++ /dev/null @@ -1,7 +0,0 @@ -struct Foo { int member; }; - -void g(Foo *foo) -{ - foo->. -} - diff --git a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForColonColon.cpp b/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForColonColon.cpp deleted file mode 100644 index 62af4343c1..0000000000 --- a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForColonColon.cpp +++ /dev/null @@ -1 +0,0 @@ -Blah:: diff --git a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForDotDot.cpp b/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForDotDot.cpp deleted file mode 100644 index 8f77989da6..0000000000 --- a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForDotDot.cpp +++ /dev/null @@ -1,7 +0,0 @@ -struct Foo { int member; }; - -void g(Foo *foo) -{ - foo.. -} - diff --git a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForFloat.cpp b/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForFloat.cpp deleted file mode 100644 index c27a0ee8f0..0000000000 --- a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForFloat.cpp +++ /dev/null @@ -1,4 +0,0 @@ -void f() -{ - float pi = 3. -} diff --git a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForObject.cpp b/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForObject.cpp deleted file mode 100644 index d2e3b88da7..0000000000 --- a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForObject.cpp +++ /dev/null @@ -1,6 +0,0 @@ -struct Foo { int member; }; - -void g(Foo foo) -{ - foo. -} diff --git a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForObjectWithArrowOperator.cpp b/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForObjectWithArrowOperator.cpp deleted file mode 100644 index 6a741603a1..0000000000 --- a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForObjectWithArrowOperator.cpp +++ /dev/null @@ -1,9 +0,0 @@ -struct Foo { - Foo *operator->(); - int member; -}; - -void g(Foo foo) -{ - foo. -} diff --git a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForOnlyDot.cpp b/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForOnlyDot.cpp deleted file mode 100644 index 1607d6a6fb..0000000000 --- a/tests/unit/unittest/data/complete_withNoDotArrowCorrectionForOnlyDot.cpp +++ /dev/null @@ -1,7 +0,0 @@ -struct Foo { int member; }; - -void g(Foo *foo) -{ - . // white space preserver -} - diff --git a/tests/unit/unittest/data/completions_order.cpp b/tests/unit/unittest/data/completions_order.cpp deleted file mode 100644 index 3812225ad7..0000000000 --- a/tests/unit/unittest/data/completions_order.cpp +++ /dev/null @@ -1,41 +0,0 @@ -class Constructor { -public: - Constructor() = default; - Constructor(int) {} -}; - -void testConstructor() { - -} - -class Base { - virtual void bar(int a) const; -}; - -class DifferentPriorities : public Base { -public: - void foo(); - void foo() const; - void bar(int a) const override; - void testBar() { - - } -}; - -void testPriorities() { - DifferentPriorities d; - d. -} - -class LexicographicalSorting -{ -public: - void memberFuncBB(); - void memberFuncC(); - void memberFuncAAA() const; -}; - -void testLexicographicalSorting() { - LexicographicalSorting ls; - ls.memberFunc -} diff --git a/tests/unit/unittest/data/cursor.cpp b/tests/unit/unittest/data/cursor.cpp deleted file mode 100644 index 82df2cb378..0000000000 --- a/tests/unit/unittest/data/cursor.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#include "cursor.h" - -void function(int x) -{ - -} - -namespace Namespace -{ -SuperClass::SuperClass(int x) noexcept - : y(x) -{ - int LocalVariable; -} - -int SuperClass::Method() -{ - Method(); - AbstractVirtualMethod(y); - int LocalVariable; - return y; -} - -int SuperClass::VirtualMethod(int z) -{ - AbstractVirtualMethod(z); - - return y; -} - -bool SuperClass::ConstMethod() const -{ - return y; -} - -void SuperClass::StaticMethod() -{ - using longint = long long int; - using lint = longint; - - lint foo; - - foo = 30; - - const lint bar = 20; -} -} - -template <class T> -void TemplateFunction(T LocalVariableParameter) -{ - T LocalVariable; -} - -Namespace::SuperClass::operator int() const -{ - int LocalVariable; -} - -int Namespace::SuperClass::operator ++() const -{ - int LocalVariable; - - return LocalVariable; -} - -Namespace::SuperClass::~SuperClass() -{ - int LocalVariable; -} - -void Struct::FinalVirtualMethod() -{ - -} - -void f1(Struct *FindFunctionCaller) -{ - FindFunctionCaller->FinalVirtualMethod(); -} - -void f2(){ - Struct *s = new Struct; - - f1(s); -} - -void f3() -{ - auto FindFunctionCaller = Struct(); - - FindFunctionCaller.FinalVirtualMethod(); -} - - -void f4() -{ - Struct s; - - auto *sPointer = &s; - auto sValue = s; -} - -void NonFinalStruct::function() -{ - FinalVirtualMethod(); -} - -void OutputFunction(int &out, int in = 1, const int &in2=2, int *out2=nullptr); -void InputFunction(const int &value); - -void f5() -{ - int OutputValue; - int InputValue = 20; - - OutputFunction(OutputValue); - InputFunction(InputValue); -} - -void ArgumentCountZero(); -void ArgumentCountTwo(int one, const int &two); -void IntegerValue(int); -void LValueReference(int &); -void ConstLValueReference(const int &); -void PointerToConst(const int *); -void Pointer(int *); -void ConstantPointer(int *const); -void ConstIntegerValue(const int); - -void NonFinalStruct::ProtectedMethodAccessSpecifier() {} - -extern int ExternVarStorageClass; - -static void StaticMethodStorageClass() {} - -template<class T> const T &InvalidStorageClass(const T &type) { return type; } - -namespace Outer { -namespace { - -} - -enum { - X, Y -}; -} diff --git a/tests/unit/unittest/data/cursor.h b/tests/unit/unittest/data/cursor.h deleted file mode 100644 index 7db9be6e97..0000000000 --- a/tests/unit/unittest/data/cursor.h +++ /dev/null @@ -1,44 +0,0 @@ - - - -namespace Namespace -{ -class SuperClass; -/** - * A brief comment - */ -class SuperClass -{ - SuperClass() = default; - SuperClass(int x) noexcept; - int Method(); - virtual int VirtualMethod(int z); - virtual int AbstractVirtualMethod(int z) = 0; - bool ConstMethod() const; - static void StaticMethod(); - operator int() const; - int operator ++() const; - ~SuperClass(); - -private: - int y; -}; -} - -struct Struct final -{ - virtual void FinalVirtualMethod() final; -}; - -union Union -{ - -}; - -struct NonFinalStruct -{ - virtual void FinalVirtualMethod() final; - void function(); -protected: - void ProtectedMethodAccessSpecifier(); -}; diff --git a/tests/unit/unittest/data/diagnostic_diagnostic.cpp b/tests/unit/unittest/data/diagnostic_diagnostic.cpp deleted file mode 100644 index 51423c20b5..0000000000 --- a/tests/unit/unittest/data/diagnostic_diagnostic.cpp +++ /dev/null @@ -1,8 +0,0 @@ -int noReturnValue() -{ -} - -void f(int) -{ - f(); -} diff --git a/tests/unit/unittest/data/diagnostic_diagnosticset.cpp b/tests/unit/unittest/data/diagnostic_diagnosticset.cpp deleted file mode 100644 index 20ea8ffe1e..0000000000 --- a/tests/unit/unittest/data/diagnostic_diagnosticset.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int function() -{ - -} - diff --git a/tests/unit/unittest/data/diagnostic_diagnosticset_header.cpp b/tests/unit/unittest/data/diagnostic_diagnosticset_header.cpp deleted file mode 100644 index cf05802cb6..0000000000 --- a/tests/unit/unittest/data/diagnostic_diagnosticset_header.cpp +++ /dev/null @@ -1,2 +0,0 @@ -void f() {} - diff --git a/tests/unit/unittest/data/diagnostic_diagnosticset_mainfile.cpp b/tests/unit/unittest/data/diagnostic_diagnosticset_mainfile.cpp deleted file mode 100644 index 323842ca58..0000000000 --- a/tests/unit/unittest/data/diagnostic_diagnosticset_mainfile.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "diagnostic_diagnosticset_header.cpp" - -void f() {} - diff --git a/tests/unit/unittest/data/diagnostic_erroneous_header.h b/tests/unit/unittest/data/diagnostic_erroneous_header.h deleted file mode 100644 index 5dd2740c16..0000000000 --- a/tests/unit/unittest/data/diagnostic_erroneous_header.h +++ /dev/null @@ -1,11 +0,0 @@ -int warningInHeader() -{ -} - -void myfun() -{ - int i = 0; - if (i = 3) {} -} - -errorInHeader; diff --git a/tests/unit/unittest/data/diagnostic_erroneous_source.cpp b/tests/unit/unittest/data/diagnostic_erroneous_source.cpp deleted file mode 100644 index a0efee52b5..0000000000 --- a/tests/unit/unittest/data/diagnostic_erroneous_source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "diagnostic_erroneous_header.h" - -enum Numbers { One, Two, Three }; - -void f(Numbers n) -{ - switch (n) { - case One: return; - case Two: return; - } -} - -void g() -{ - return 3; -} - -void function() -{ - int i = 0; - if (i = 3) {} -} - - diff --git a/tests/unit/unittest/data/diagnostic_semicolon_fixit.cpp b/tests/unit/unittest/data/diagnostic_semicolon_fixit.cpp deleted file mode 100644 index 8b7eb2c657..0000000000 --- a/tests/unit/unittest/data/diagnostic_semicolon_fixit.cpp +++ /dev/null @@ -1,4 +0,0 @@ -int function() -{ - return 3 -} diff --git a/tests/unit/unittest/data/diagnostic_source_location.cpp b/tests/unit/unittest/data/diagnostic_source_location.cpp deleted file mode 100644 index 537675c619..0000000000 --- a/tests/unit/unittest/data/diagnostic_source_location.cpp +++ /dev/null @@ -1,9 +0,0 @@ -int function() -{ - -} - -int function2() -{ - /*abcdЙf*/ -} diff --git a/tests/unit/unittest/data/diagnostic_source_range.cpp b/tests/unit/unittest/data/diagnostic_source_range.cpp deleted file mode 100644 index 121d402ea8..0000000000 --- a/tests/unit/unittest/data/diagnostic_source_range.cpp +++ /dev/null @@ -1,13 +0,0 @@ -class XXX -{ - -}; - -int function(XXX i) -{ - i + 20; -} - -struct Foo { - someIdentifierLeadingToInvalidRange; -}; diff --git a/tests/unit/unittest/data/empty1.cpp b/tests/unit/unittest/data/empty1.cpp deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/unit/unittest/data/empty1.cpp +++ /dev/null diff --git a/tests/unit/unittest/data/empty2.cpp b/tests/unit/unittest/data/empty2.cpp deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/unit/unittest/data/empty2.cpp +++ /dev/null diff --git a/tests/unit/unittest/data/empty3.cpp b/tests/unit/unittest/data/empty3.cpp deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/unit/unittest/data/empty3.cpp +++ /dev/null diff --git a/tests/unit/unittest/data/followsymbol_header.h b/tests/unit/unittest/data/followsymbol_header.h deleted file mode 100644 index 8630834023..0000000000 --- a/tests/unit/unittest/data/followsymbol_header.h +++ /dev/null @@ -1,59 +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 - -#define TEST_DEFINE 1 -namespace Fooish -{ -float flvalue = 100.f; - -class Bar; - -class Bar { -public: - Bar(); - - volatile int member = 0; -}; - -struct Barish -{ - int foo(float p, int u); - int mem = 10; -}; -} - -class FooClass; - -int foo(const float p, int u); - -int foo(); - -int foo(float p, int u) -{ - return foo() + p + u; -} - -int foo(int x, float y); diff --git a/tests/unit/unittest/data/followsymbol_main.cpp b/tests/unit/unittest/data/followsymbol_main.cpp deleted file mode 100644 index f967d8653b..0000000000 --- a/tests/unit/unittest/data/followsymbol_main.cpp +++ /dev/null @@ -1,95 +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 "followsymbol_header.h" -#include "cursor.h" -Fooish::Bar::Bar() { - -} - -class X; - -using YYY = Fooish::Bar; - -int foo() { - YYY bar; - bar.member = 30; - Fooish::Barish barish; - bar.member++; - barish.mem = Fooish::flvalue; - - barish.foo(1.f, 2); - foo(1, 2.f); - return 1; - - X* x; -} - -int Fooish::Barish::foo(float p, int u) -{ - return ::foo() + p + u; -} - -class FooClass -{ -public: - FooClass(); - static int mememember; -}; - -FooClass::FooClass() { - NonFinalStruct nfStruct; nfStruct.function(); -} - -int main() { - return foo() + FooClass::mememember + TEST_DEFINE; -} - -class Bar -{ -public: - int operator&(); - Bar& operator[](int); -}; - -int Bar::operator&() { - return 0; -} - -Bar& Bar::operator[](int) { - return *this; -} - -struct S { - union { - int i = 12; - void *something; - }; - int func(bool b) { - if (b) - return i; - int i = 42; - return i; - } -}; diff --git a/tests/unit/unittest/data/highlightingmarks.cpp b/tests/unit/unittest/data/highlightingmarks.cpp deleted file mode 100644 index 57f4586dab..0000000000 --- a/tests/unit/unittest/data/highlightingmarks.cpp +++ /dev/null @@ -1,811 +0,0 @@ -auto *Variable = "Variable"; -auto *u8Variable = u8"Variable"; -auto *rawVariable = R"(Variable)"; -auto Character = 'c'; - - - - - - - - - - - - - - - - - - -auto integer = 1; -auto numFloat = 1.2f; - - - - - - - - - - - - - - - - - - - - -int function(int x) -{ - return x; -} - -struct Foo -{ - void memberFunction() {} -}; - -int functionDeclaration(int x); - -struct Foo2 -{ - void memberFunction(); -}; - -void f() -{ - function(1); -} - -struct ConversionFunction { - operator Foo(); - operator int(); -}; - -void TypeReference() -{ - Foo foo; -} - -void LocalVariableDeclaration() -{ - Foo foo; - - foo.memberFunction(); -} - -void LocalVariableFunctionArgument(Foo &foo) -{ - foo.memberFunction(); -} - -struct Foo3 { - int ClassMember; - - void ClassMemberReference() - { - ClassMember++; - } -}; - -struct Foo4 -{ - void MemberFunctionReference(); - - void function() - { - MemberFunctionReference(); - } -}; - -struct Foo5 -{ - void StaticMethod(); - - void function() - { - Foo5::StaticMethod(); - } -}; - -enum Enumeration -{ - Enumerator -}; - -void f2() -{ - Enumeration enumeration; - - enumeration = Enumerator; -} - -class ForwardReference; - -class Class -{ public: - Class(); - ~Class(); -}; - -ForwardReference *f3() -{ - Class ConstructorReference; - - return 0; -} - -union Union -{ - -}; - -Union UnionDeclarationReference; - - - - - - - - - -namespace NameSpace { -struct StructInNameSpace {}; -} - -namespace NameSpaceAlias = NameSpace; -using NameSpace::StructInNameSpace; -NameSpace::StructInNameSpace foo6; - -class BaseClass { -public: - virtual void VirtualFunction(); - virtual void FinalVirtualFunction(); -}; - - -void f8() -{ - BaseClass NonVirtualFunctionCall; - NonVirtualFunctionCall.VirtualFunction(); - - BaseClass *NonVirtualFunctionCallPointer = new BaseClass(); - NonVirtualFunctionCallPointer->VirtualFunction(); -} - -class DerivedClass : public BaseClass -{public: - void VirtualFunction() override; - void FinalVirtualFunction() final; -}; - -void f8(BaseClass *VirtualFunctionCallPointer) -{ - VirtualFunctionCallPointer->VirtualFunction(); -} - -class FinalClass final : public DerivedClass -{ - void FinalClassThisCall(); -}; - -void f8(DerivedClass *FinalVirtualFunctionCallPointer) -{ - FinalVirtualFunctionCallPointer->FinalVirtualFunction(); -} - -void f9(BaseClass *NonFinalVirtualFunctionCallPointer) -{ - NonFinalVirtualFunctionCallPointer->FinalVirtualFunction(); -} - -void f10(FinalClass *ClassFinalVirtualFunctionCallPointer) -{ - ClassFinalVirtualFunctionCallPointer->VirtualFunction(); -} - -class Operator { -public: - Operator operator+=(const Operator &first); -}; - -Operator operator+(const Operator &first, const Operator &second); - -void f10() -{ - auto PlusOperator = Operator() + Operator(); - Operator PlusAssignOperator; - PlusAssignOperator += Operator(); -} - -/* Comment */ - -#define PreprocessorDefinition Class -#define MacroDefinition(a,b) ((a)>(b)?(a):(b)) - -void f11() -{ - MacroDefinition(2, 4); -} - -#include "highlightingmarks.h" - -void f12() { -GOTO_LABEL: - - goto GOTO_LABEL; -} - -template <class T> -void TemplateFunction(T v) -{ - T XXXXX = v; -} -void TemplateReference() -{ - TemplateFunction(1); -// std::vector<int> TemplateIntance; -} - - - - -template <class T> -class TemplateFoo {}; - - -template <class TemplateTypeParameter = Foo, int NonTypeTemplateParameter = 1, template <class> class TemplateTemplateParameter = TemplateFoo> -void TemplateFunction(TemplateTypeParameter TemplateParameter) -{ - TemplateTypeParameter TemplateTypeParameterReference; - auto NonTypeTemplateParameterReference = NonTypeTemplateParameter; - TemplateTemplateParameter<TemplateTypeParameter> TemplateTemplateParameterReference; -} - - - -void FinalClass::FinalClassThisCall() -{ - VirtualFunction(); -} - - -void OutputArgument(int &one, const int &two, int *three=0); - -void f12b() -{ - int One; - OutputArgument(One, 2); -} - -#include <highlightingmarks.h> - -#define FOREACH(variable, container) \ - variable; \ - auto x = container; - -#define foreach2 FOREACH - - - -void f13() -{ - auto container = 1; - foreach2(int index, container); -} - -class SecondArgumentInMacroExpansionIsField { - int container = 1; - - void f() - { - foreach2(int index, container); - } -}; - -typedef unsigned uint32; - -enum EnumerationType : uint32 -{ - Other = 0, -}; - - -struct TypeInCast { - void function(); -}; - -void f14() -{ - static_cast<void (TypeInCast::*)()>(&TypeInCast::function); - reinterpret_cast<void (TypeInCast::*)()>(&TypeInCast::function); -} - -using IntegerAlias = int; -using SecondIntegerAlias = IntegerAlias; -typedef int IntegerTypedef; -using Function = void (*)(); - - - -void f15() -{ - IntegerAlias integerAlias; - SecondIntegerAlias secondIntegerAlias; - IntegerTypedef integerTypedef; - Function(); -} - -class FriendFoo -{ -public: - friend class FooFriend; - friend bool operator==(const FriendFoo &first, const FriendFoo &second); -}; - -class FieldInitialization -{ -public: - FieldInitialization() : - member(0) - {} - - int member; -}; - -template<class Type> -void TemplateFunctionCall(Type type) -{ - type + type; -} - -void f16() -{ - TemplateFunctionCall(1); -} - - -template <typename T> -class TemplatedType -{ - T value = T(); -}; - -void f17() -{ - TemplatedType<int> TemplatedTypeDeclaration; -} - -void f18() -{ - auto value = 1 + 2; -} - -class ScopeClass -{ -public: - static void ScopeOperator(); -}; - -void f19() -{ - ScopeClass::ScopeOperator(); -} - -namespace TemplateClassNamespace { -template<class X> -class TemplateClass -{ - -}; -} - -void f20() -{ - TemplateClassNamespace::TemplateClass<ScopeClass> TemplateClassDefinition; -} - -void f21() -{ - typedef int TypeDefDeclaration; - TypeDefDeclaration TypeDefDeclarationUsage; -} - -typedef int EnumerationTypeDef; - -enum Enumeration2 : EnumerationTypeDef { - -}; - -struct Bar { - Bar &operator[](int &key); -}; - -void argumentToUserDefinedIndexOperator(Bar object, int index = 3) -{ - object[index]; -} - -struct LambdaTester -{ - int member = 0; - void func() { - const int var = 42, var2 = 84; - auto lambda = [var, this](int input) { - return var + input + member; - }; - lambda(var2); - } -}; - -void NonConstReferenceArgument(int &argument); - -void f22() -{ - int x = 1; - - NonConstReferenceArgument(x); -} - -void ConstReferenceArgument(const int &argument); - -void f23() -{ - int x = 1; - - ConstReferenceArgument(x); -} - -void RValueReferenceArgument(int &&argument); - -void f24() -{ - int x = 1; - - RValueReferenceArgument(static_cast<int&&>(x)); -} - -void NonConstPointerArgument(int *argument); - -void f25() -{ - int *x; - - NonConstPointerArgument(x); -} - -void PointerToConstArgument(const int *argument); -void ConstPointerArgument(int *const argument); -void f26() -{ - int *x; - PointerToConstArgument(x); - ConstPointerArgument(x); -} - -void NonConstReferenceArgumentCallInsideCall(int x, int &argument); -int GetArgument(int x); - -void f27() -{ - int x = 1; - - NonConstReferenceArgumentCallInsideCall(GetArgument(x), x); -} - -void f28(int &Reference) -{ - NonConstReferenceArgument(Reference); -} - -void f29() -{ - int x; - - NonConstPointerArgument(&x); -} - -struct NonConstPointerArgumentAsMemberOfClass -{ - int member; -}; - -void f30() -{ - NonConstPointerArgumentAsMemberOfClass instance; - - NonConstReferenceArgument(instance.member); -} - -struct NonConstReferenceArgumentConstructor -{ - NonConstReferenceArgumentConstructor() = default; - NonConstReferenceArgumentConstructor(NonConstReferenceArgumentConstructor &other); - - void NonConstReferenceArgumentMember(NonConstReferenceArgumentConstructor &other); -}; - -void f31() -{ - NonConstReferenceArgumentConstructor instance; - - NonConstReferenceArgumentConstructor copy(instance); -} - -struct NonConstReferenceMemberInitialization -{ - NonConstReferenceMemberInitialization(int &foo) - : foo(foo) - {} - - int &foo; -}; - -template<class T> class Coo; -template<class T> class Coo<T*>; - -namespace N { void goo(); } -using N::goo; - -#if 1 -#endif - -#include <new> - -struct OtherOperator { void operator()(int); }; -void g(OtherOperator o, int var) -{ - o(var); -} - -void NonConstPointerArgument(int &argument); - -struct PointerGetterClass -{ - int &getter(); -}; - -void f32() -{ - PointerGetterClass x; - - NonConstPointerArgument(x.getter()); -} - -namespace N { template <typename T> void SizeIs(); } -using N::SizeIs; - -void BaseClass::VirtualFunction() {} - -class WithVirtualFunctionDefined { - virtual void VirtualFunctionDefinition() {}; -}; - -namespace NFoo { namespace NBar { namespace NTest { class NamespaceTypeSpelling; } } } - -Undeclared u; -#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) -}; - -struct X { - void operator*(int) {} -}; - -void operator*(X, float) {} - -void CallSite() { - X x; - int y = 10; - float z = 10; - x * y; - x * z; -} - -struct Dummy { - Dummy operator<<=(int key); - Dummy operator()(int a); - int& operator[] (unsigned index); - void* operator new(unsigned size); - void operator delete(void* ptr); - void* operator new[](unsigned size); - void operator delete[](void* ptr); -}; - -void TryOverloadedOperators(Dummy object) -{ - object <<= 3; - - Dummy stacked; - stacked(4); - stacked[1]; - int *i = new int; - Dummy* use_new = new Dummy(); - delete use_new; - Dummy* many = new Dummy[10]; - delete [] many; -} - -enum { - Test = 0 -}; - -namespace { -class B { - struct { - int a; - }; -}; -} - -struct Dummy2 { - Dummy2 operator()(); - int operator*(); - Dummy2 operator=(int foo); -}; - -void TryOverloadedOperators2(Dummy object) -{ - Dummy2 dummy2; - dummy2(); - *dummy2; - dummy2 = 3; -} - -int OperatorTest() { - return 1 < 2 ? 20 : 30; -} - -int signalSlotTest() { - SIGNAL(something(QString)); - SLOT(something(QString)); - SIGNAL(something(QString (*func1)(QString))); - 1 == 2; -} - -class NonConstParameterConstructor -{ - NonConstParameterConstructor() = default; - NonConstParameterConstructor(NonConstParameterConstructor &buildDependenciesStorage); - - void Call() - { - NonConstParameterConstructor foo; - NonConstParameterConstructor bar(foo); - } -}; - -class StaticMembersAccess -{ -protected: - static int protectedValue; - -private: - static int privateValue; -}; - -template <int i, int j> struct S { }; -template <int i> using spec = S<i, 1>; -spec<2> s; - -class Property { - Q_PROPERTY( - - const - - volatile - - unsigned - - long - - long - - * - - prop - - READ - - getProp - - WRITE - - setProp - - NOTIFY - - propChanged - - ) -}; - -void structuredBindingTest() { - const int a[] = {1, 2}; - const auto [x, y] = a; -} - -#define ASSIGN(decl, ptr) do { decl = *ptr; } while (false) -#define ASSIGN2 ASSIGN -void f4() -{ - int *thePointer = 0; - ASSIGN(int i, thePointer); - ASSIGN2(int i, thePointer); -} - -const int MyConstant = 8; -void f5() -{ - int arr[MyConstant][8]; -} - -static int GlobalVar = 0; - -namespace N { [[deprecated]] void f(); } - -template<typename T> -void func(T v); - -void f6() -{ - GlobalVar = 5; - func(1); // QTCREATORBUG-21856 -} - -template<typename T> -void func(T v) { - GlobalVar = 5; -} - -static std::vector<std::pair<int, int>> pv; - -template <class T, long S> -struct vecn -{ - T v[S]; -}; - -template <class T, long S> -static inline constexpr vecn<T, S> operator<(vecn<T, S> a, vecn<T, S> b) -{ - vecn<T, S> x = vecn<T, S>{}; - for(long i = 0; i < S; ++i) - { - x[i] = a[i] < b[i]; - } - return x; -} - -const char *cyrillic = "б"; - -struct foo { -#define blubb -}; - -#define test_micro(A,B) ((A##B>1?A:B)) - -int a = (a1 > 0); - -int func() { - int a = (a1 > 0); -} - -namespace std { - template<typename T1, typename T2> struct pair; - template<typename T> struct vector; -} - -static std::vector<std::pair<int, int>> pvr; diff --git a/tests/unit/unittest/data/highlightingmarks.h b/tests/unit/unittest/data/highlightingmarks.h deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/unit/unittest/data/highlightingmarks.h +++ /dev/null diff --git a/tests/unit/unittest/data/include_testfile.cpp b/tests/unit/unittest/data/include_testfile.cpp deleted file mode 100644 index 9be5fa082f..0000000000 --- a/tests/unit/unittest/data/include_testfile.cpp +++ /dev/null @@ -1,27 +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 <vector> - diff --git a/tests/unit/unittest/data/references.cpp b/tests/unit/unittest/data/references.cpp deleted file mode 100644 index 32ff1b9075..0000000000 --- a/tests/unit/unittest/data/references.cpp +++ /dev/null @@ -1,174 +0,0 @@ -void variableSingleReference() -{ - int foo; -} - - - -int variableMultipleReferences() -{ - int foo = 0; - return foo; -} - - - -class Foo {}; -void bla() -{ - Foo foo; -} - - - -namespace N { class Bar {}; } -namespace N { class Baz {}; } -N::Bar bar; - - - -namespace G { class App {}; } -using G::App; - - - -class Hoo; -void f(const Hoo &); - - - -class Moo {}; -void x() -{ - new Moo; -} - - - -class Element {}; -template<typename T> struct Wrap { T member; }; -void g() -{ - Wrap<Element> con; - con.member; -} - - - -template<typename T> -struct Wrapper { - T f() - { - int foo; - ++foo; - return mem; - } - - T mem; -}; - - - -template<typename T> -void f() -{ - T mem; - mem.foo(); -} - - - -struct Woo { - Woo(); - ~Woo(); -}; - - - -int muu(); -int muu(int); - - - -struct Doo { - int muu(); - int muu(int); -}; - - - -template<typename T> int tuu(); -int tuu(int); - - - -struct Xoo { - template<typename T> int tuu(); - int tuu(int); -}; - - - -enum ET { E1 }; -bool e(ET e) -{ - return e == E1; -} - - - -struct LData { int member; }; -void lambda(LData foo) { - auto l = [bar=foo] { return bar.member; }; -} - - - -template<class T> class Coo; -template<class T> class Coo<T*>; -template<> class Coo<int>; - - - -template<typename T> typename T::foo n() -{ - typename T::bla hello; -} - - - -int rec(int n = 100) -{ - return n == 0 ? 0 : rec(--n); -} - - - -#define FOO 3 -int objectLikeMacro() -{ - return FOO; -} - - - -#define BAR(x) x -int functionLikeMacro(int foo) -{ - return BAR(foo); -} - -template<class T> -class Container -{ -public: - T &operator[](int); T &operator()(int, int); -}; - -int testOperator() { - Container<int> vec; - - int n = 10; - vec[n] = n * 100; - vec(n, n) = 100; -} diff --git a/tests/unit/unittest/data/skippedsourceranges.cpp b/tests/unit/unittest/data/skippedsourceranges.cpp deleted file mode 100644 index 775393fced..0000000000 --- a/tests/unit/unittest/data/skippedsourceranges.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#if 0 - -void f(); - -#endif - -#ifndef BLAH -class Class -{ - -}; -#endif - -#ifdef BLAH -class Class -{ - -}; -#endif diff --git a/tests/unit/unittest/data/token.cpp b/tests/unit/unittest/data/token.cpp deleted file mode 100644 index 2fccc37acf..0000000000 --- a/tests/unit/unittest/data/token.cpp +++ /dev/null @@ -1,3 +0,0 @@ -void function(int x) -{ -} diff --git a/tests/unit/unittest/data/tooltipinfo.cpp b/tests/unit/unittest/data/tooltipinfo.cpp deleted file mode 100644 index bc1f17066e..0000000000 --- a/tests/unit/unittest/data/tooltipinfo.cpp +++ /dev/null @@ -1,212 +0,0 @@ -void f(int foo, const int *cfoo) -{ - foo++; - cfoo++; -} - - - -struct Foo { int member = 0; }; -int g(const Foo &foo) -{ - return foo.member; - const Foo bar; - bar; -} - -struct Bar { virtual ~Bar(); int mem(){} virtual int virtualConstMem() const; }; -void h(const Foo &foo, Bar &bar) -{ - g(foo); - bar.mem(); - bar.virtualConstMem(); -} - - -template <typename T> -void t(int foo) { (void)foo; } -void c() -{ - t<Foo>(3); -} - - - -/** - * \brief This is a crazy function. - */ -void documentedFunction(); -void d() -{ - documentedFunction(); -} - - - -enum EnumType { V1, V2, Custom = V2 + 5 }; -EnumType e() -{ - return EnumType::Custom; -} - - - -template <typename T> struct Baz { T member; }; -void t2(const Baz<int> &b) { - Baz<int> baz; baz = b; -} - -#include "tooltipinfo.h" - - - -#define MACRO_FROM_MAINFILE(x) x + 3 -void foo() -{ - MACRO_FROM_MAINFILE(7); - MACRO_FROM_HEADER(7); -} - - - -namespace N { struct Muu{}; } -namespace G = N; -void o() -{ - using namespace N; - Muu muu; (void)muu; -} -void n() -{ - using namespace G; - Muu muu; (void)muu; -} -void q() -{ - using N::Muu; - Muu muu; (void)muu; -} - - - -struct Sizes -{ - char memberChar1; - char memberChar2; -}; -enum class FancyEnumType { V1, V2 }; -union Union -{ - char memberChar1; - char memberChar2; -}; - - - -namespace X { -namespace Y { -} -} - - - -template<typename T> struct Ptr {}; -struct Nuu {}; - -typedef Ptr<Nuu> PtrFromTypeDef; -using PtrFromTypeAlias = Ptr<Nuu>; -template<typename T> using PtrFromTemplateTypeAlias = Ptr<T>; - -void y() -{ - PtrFromTypeDef b; (void)b; - PtrFromTypeAlias a; (void)a; - PtrFromTemplateTypeAlias<Nuu> c; (void)c; -} - - - -template <typename T> struct Zii {}; -namespace U { template <typename T> struct Yii {}; } -void mc() -{ - using namespace U; - Zii<int> zii; (void) zii; - Yii<int> yii; (void) yii; -} - - - -namespace A { struct X {}; } -namespace B = A; -void ab() -{ - B::X x; (void)x; -} - - - -namespace N { -struct Outer -{ - template <typename T> struct Inner {}; - Inner<int> inner; -}; -} - - - -void f(); -namespace R { void f(); } -void f(int param); -void z(int = 1); -void user() -{ - f(); - R::f(); - f(1); - z(); -} - - - - -void autoTypes() -{ - auto a = 3; (void)a; - auto b = EnumType::V1; (void)b; - auto c = Bar(); (void)c; - auto d = Zii<int>(); (void)d; -} - - - - -struct Con {}; -struct ExplicitCon { - ExplicitCon() = default; - ExplicitCon(int m) :member(m) {} - int member; -}; -void constructor() -{ - Con(); - ExplicitCon(); - ExplicitCon(2); -} - -Nuu **pointers(Nuu **p1) -{ - return p1; -} - -static constexpr int calcValue() { return 1 + 2; } -const auto val = calcValue() + sizeof(char); - -const int zero = 0; - -static void func() -{ - const int i = 5; - const int j = i; -} diff --git a/tests/unit/unittest/data/tooltipinfo.h b/tests/unit/unittest/data/tooltipinfo.h deleted file mode 100644 index 47d3bb92e7..0000000000 --- a/tests/unit/unittest/data/tooltipinfo.h +++ /dev/null @@ -1,3 +0,0 @@ -#define MACRO_FROM_HEADER(x) x + \ - x + \ - x diff --git a/tests/unit/unittest/data/translationunits.cpp b/tests/unit/unittest/data/translationunits.cpp deleted file mode 100644 index 8ab60b10e1..0000000000 --- a/tests/unit/unittest/data/translationunits.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "translationunits.h" -#include "some/unresolved/file.h" - -void function() -{ - -} - diff --git a/tests/unit/unittest/data/translationunits.h b/tests/unit/unittest/data/translationunits.h deleted file mode 100644 index 67bc13701d..0000000000 --- a/tests/unit/unittest/data/translationunits.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -void FunctionInIncludedHeader(); diff --git a/tests/unit/unittest/data/uicmain.cpp b/tests/unit/unittest/data/uicmain.cpp deleted file mode 100644 index 7739b1027b..0000000000 --- a/tests/unit/unittest/data/uicmain.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "uicheader.h" - -static UicObject o; diff --git a/tests/unit/unittest/sourcerangecontainer-matcher.h b/tests/unit/unittest/sourcerangecontainer-matcher.h deleted file mode 100644 index c2345be533..0000000000 --- a/tests/unit/unittest/sourcerangecontainer-matcher.h +++ /dev/null @@ -1,67 +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 "googletest.h" - -using testing::PrintToString; - -namespace { - -MATCHER_P4(IsSourceRange, startLine, startColumn, endLine, endColumn, - std::string(negation ? "isn't" : "is") - + "[(" + PrintToString(startLine) - + ", " + PrintToString(startColumn) - + "), (" + PrintToString(endLine) - + ", " + PrintToString(endColumn) - + ")]" - ) -{ - return arg.start.line == uint(startLine) - && arg.start.column == uint(startColumn) - && arg.end.line == uint(endLine) - && arg.end.column == uint(endColumn); -} - -MATCHER_P5(IsSourceRangeWithText, startLine, startColumn, endLine, endColumn, text, - std::string(negation ? "isn't " : "is ") - + "((" + PrintToString(startLine) - + ", " + PrintToString(startColumn) - + "), (" + PrintToString(endLine) - + ", " + PrintToString(endColumn) - + "), " + PrintToString(text) - + ")" - ) -{ - return arg.start.line == uint(startLine) - && arg.start.column == uint(startColumn) - && arg.end.line == uint(endLine) - && arg.end.column == uint(endColumn) - && arg.text.toCarriageReturnsStripped() == text; - -} - -} diff --git a/tests/unit/unittest/unittest.qbs b/tests/unit/unittest/unittest.qbs index 21fa47cb43..143ec4de46 100644 --- a/tests/unit/unittest/unittest.qbs +++ b/tests/unit/unittest/unittest.qbs @@ -15,9 +15,6 @@ Project { FileInfo.relativePath(project.ide_source_tree, sourceDirectory)) install: false - Depends { name: "libclang"; required: false } - Depends { name: "clang_defines" } - Depends { name: "QmlDesigner"; required: false } Depends { name: "sqlite_sources" } @@ -39,7 +36,6 @@ Project { "QT_RESTRICTED_CAST_FROM_ASCII", "QT_USE_FAST_OPERATOR_PLUS", "QT_USE_FAST_CONCATENATION", - "CPPEDITOR_STATIC_LIBRARY", "UNIT_TESTS", "DONT_CHECK_MESSAGE_COUNTER", 'QTC_RESOURCE_DIR="' + path + "/../../../share/qtcreator" + '"', @@ -47,9 +43,6 @@ Project { 'RELATIVE_DATA_PATH="' + FileInfo.relativePath(destinationDirectory, FileInfo.joinPaths(project.sourceDirectory, "share", "qtcreator")) + '"', ]; - if (libclang.present) { - defines.push("CLANG_UNIT_TESTS"); - } var absLibExecPath = FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, qtc.ide_libexec_path); var relLibExecPath = FileInfo.relativePath(destinationDirectory, absLibExecPath); @@ -76,47 +69,18 @@ Project { return flags; } cpp.cxxLanguageVersion: "c++17" - cpp.dynamicLibraries: { - var libs = []; - if (libclang.present) { - libs = libs.concat(libclang.llvmLibs); - if (libclang.llvmFormattingLibs.length - && (!qbs.targetOS.contains("windows") || libclang.llvmBuildModeMatches)) { - libs = libs.concat(libclang.llvmFormattingLibs); - } - } - return libs; - } - cpp.includePaths: { - var paths = [ - ".", - "../mockup", - "../../../src/libs", - "../../../src/libs/3rdparty", - "../../../src/plugins", - "../../../src/plugins/clangcodemodel", - "../../../share/qtcreator/qml/qmlpuppet/types", - ]; - if (libclang.present) { - paths.push(libclang.llvmIncludeDir); - } - return paths; - } - cpp.libraryPaths: { - var paths = []; - if (libclang.present) - paths.push(libclang.llvmLibDir); - return paths; - } - cpp.rpaths: { - var paths = [ - FileInfo.joinPaths(project.buildDirectory, qtc.ide_library_path), - FileInfo.joinPaths(project.buildDirectory, qtc.ide_plugin_path) - ]; - if (libclang.present) - paths.push(libclang.llvmLibDir); - return paths; - } + cpp.includePaths: [ + ".", + "../mockup", + "../../../src/libs", + "../../../src/libs/3rdparty", + "../../../src/plugins", + "../../../share/qtcreator/qml/qmlpuppet/types", + ] + cpp.rpaths: [ + FileInfo.joinPaths(project.buildDirectory, qtc.ide_library_path), + FileInfo.joinPaths(project.buildDirectory, qtc.ide_plugin_path) + ] files: [ "compare-operators.h", @@ -147,7 +111,6 @@ Project { "processevents-utilities.h", "sizedarray-test.cpp", "smallstring-test.cpp", - "sourcerangecontainer-matcher.h", "spydummy.cpp", "spydummy.h", "sqlitecolumn-test.cpp", @@ -179,18 +142,8 @@ Project { name: "data" files: [ "data/*", - "data/include/*", ] fileTags: [] } - - Group { - name: "sources from cppeditor" - prefix: "../../../src/plugins/cppeditor/" - files: [ - "cppprojectfile.cpp", - "cppprojectfile.h", - ] - } } } |