| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | /****************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Copyright (C) 2018 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"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-31 10:30:58 +01:00
										 |  |  | #include "filesystem-utilities.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | #include <commandlinebuilder.h>
 | 
					
						
							|  |  |  | #include <pchtask.h>
 | 
					
						
							|  |  |  | #include <projectpartcontainer.h>
 | 
					
						
							| 
									
										
										
										
											2019-01-23 14:10:58 +01:00
										 |  |  | #include <projectpartartefact.h>
 | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace { | 
					
						
							|  |  |  | template<typename ProjectInfo> | 
					
						
							|  |  |  | using Builder = ClangBackEnd::CommandLineBuilder<ProjectInfo>; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-24 14:07:39 +02:00
										 |  |  | using ClangBackEnd::FilePath; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | using ClangBackEnd::IncludeSearchPathType; | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | using ClangBackEnd::InputFileType; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | template <typename ProjectInfo> | 
					
						
							|  |  |  | class CommandLineBuilder : public testing::Test | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <> | 
					
						
							|  |  |  | class CommandLineBuilder<ClangBackEnd::PchTask> : public testing::Test | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-04-07 15:57:42 +02:00
										 |  |  |     CommandLineBuilder() { cppProjectInfo.language = Utils::Language::Cxx; } | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-05-13 18:58:27 +02:00
										 |  |  |     ClangBackEnd::PchTask emptyProjectInfo{0, {}, {}, {}, {}, {}, {}, {}, {}, {}}; | 
					
						
							|  |  |  |     ClangBackEnd::PchTask cppProjectInfo{1, {}, {}, {}, {}, {}, {}, {}, {}, {}}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <> | 
					
						
							|  |  |  | class CommandLineBuilder<ClangBackEnd::ProjectPartContainer> : public testing::Test | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-04-07 15:57:42 +02:00
										 |  |  |     CommandLineBuilder() { cppProjectInfo.language = Utils::Language::Cxx; } | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |     ClangBackEnd::ProjectPartContainer emptyProjectInfo{0, | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                                                         {}, | 
					
						
							|  |  |  |                                                         {}, | 
					
						
							|  |  |  |                                                         {}, | 
					
						
							|  |  |  |                                                         {}, | 
					
						
							|  |  |  |                                                         {}, | 
					
						
							|  |  |  |                                                         {}, | 
					
						
							|  |  |  |                                                         Utils::Language::Cxx, | 
					
						
							|  |  |  |                                                         Utils::LanguageVersion::CXX98, | 
					
						
							|  |  |  |                                                         Utils::LanguageExtension::None}; | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |     ClangBackEnd::ProjectPartContainer cppProjectInfo{1, | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                                                       {}, | 
					
						
							|  |  |  |                                                       {}, | 
					
						
							|  |  |  |                                                       {}, | 
					
						
							|  |  |  |                                                       {}, | 
					
						
							|  |  |  |                                                       {}, | 
					
						
							|  |  |  |                                                       {}, | 
					
						
							|  |  |  |                                                       Utils::Language::Cxx, | 
					
						
							|  |  |  |                                                       Utils::LanguageVersion::CXX98, | 
					
						
							|  |  |  |                                                       Utils::LanguageExtension::None}; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 14:10:58 +01:00
										 |  |  | template <> | 
					
						
							|  |  |  | class CommandLineBuilder<ClangBackEnd::ProjectPartArtefact> : public testing::Test | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-04-07 15:57:42 +02:00
										 |  |  |     CommandLineBuilder() { cppProjectInfo.language = Utils::Language::Cxx; } | 
					
						
							| 
									
										
										
										
											2019-01-23 14:10:58 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     ClangBackEnd::ProjectPartArtefact emptyProjectInfo{{}, | 
					
						
							|  |  |  |                                                        {}, | 
					
						
							|  |  |  |                                                        {}, | 
					
						
							|  |  |  |                                                        {}, | 
					
						
							|  |  |  |                                                        {}, | 
					
						
							|  |  |  |                                                        Utils::Language::Cxx, | 
					
						
							|  |  |  |                                                        Utils::LanguageVersion::CXX98, | 
					
						
							|  |  |  |                                                        Utils::LanguageExtension::None}; | 
					
						
							|  |  |  |     ClangBackEnd::ProjectPartArtefact cppProjectInfo{{}, | 
					
						
							|  |  |  |                                                      {}, | 
					
						
							|  |  |  |                                                      {}, | 
					
						
							|  |  |  |                                                      {}, | 
					
						
							|  |  |  |                                                      {}, | 
					
						
							|  |  |  |                                                      Utils::Language::Cxx, | 
					
						
							|  |  |  |                                                      Utils::LanguageVersion::CXX98, | 
					
						
							|  |  |  |                                                      Utils::LanguageExtension::None}; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using ProjectInfos = testing::Types<ClangBackEnd::PchTask, | 
					
						
							|  |  |  |                                     ClangBackEnd::ProjectPartContainer, | 
					
						
							|  |  |  |                                     ClangBackEnd::ProjectPartArtefact>; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | TYPED_TEST_SUITE(CommandLineBuilder, ProjectInfos); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, AddToolChainArguments) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {"-m64", "-PIC"}, InputFileType::Header, {}}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, AllOf(Contains("-m64"), Contains("-PIC"))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | TYPED_TEST(CommandLineBuilder, CHeader) | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-12 16:24:34 +01:00
										 |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2019-02-12 16:24:34 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c-header", | 
					
						
							|  |  |  |                             "-std=c11", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.c"))); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | TYPED_TEST(CommandLineBuilder, CSource) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.c"}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							| 
									
										
										
										
											2019-02-15 16:13:20 +01:00
										 |  |  |                 ElementsAre("clang", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-15 16:13:20 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							|  |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c", | 
					
						
							|  |  |  |                             "-std=c11", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.c"))); | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, ObjectiveCHeader) | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "objective-c-header", | 
					
						
							|  |  |  |                             "-std=c11", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.c"))); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | TYPED_TEST(CommandLineBuilder, ObjectiveCSource) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.c"}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "objective-c", | 
					
						
							|  |  |  |                             "-std=c11", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.c"))); | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, CppHeader) | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++-header", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-01-30 09:07:45 +01:00
										 |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.cpp"))); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | TYPED_TEST(CommandLineBuilder, CppSource) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.cpp"}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							|  |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							|  |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.cpp"))); | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, ObjectiveCppHeader) | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "objective-c++-header", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-01-30 09:07:45 +01:00
										 |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.cpp"))); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | TYPED_TEST(CommandLineBuilder, ObjectiveCppSource) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.cpp"}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "objective-c++", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							|  |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.cpp"))); | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | TYPED_TEST(CommandLineBuilder, Cpp98) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c++98")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, Cpp03) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX03; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c++03")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, Cpp11) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX11; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c++11")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, Cpp14) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX14; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c++14")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, Cpp17) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX17; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c++17")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, Cpp20) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX2a; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c++2a")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuCpp98) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu++98")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuCpp03) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX03; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu++03")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuCpp11) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX11; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu++11")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuCpp14) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX14; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu++14")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuCpp17) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX17; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu++17")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuCpp20) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX2a; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu++2a")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, C89) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C89; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c89")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, C99) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C99; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c99")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, C11) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c11")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, C18) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C18; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-07 15:54:24 +01:00
										 |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=c17")); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuC89) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C89; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu89")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuC99) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C99; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu99")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuC11) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu11")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, GnuC18) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::C; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C18; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-07 15:54:24 +01:00
										 |  |  |     ASSERT_THAT(builder.commandLine, Contains("-std=gnu17")); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, IncludesOrder) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->emptyProjectInfo.language = Utils::Language::Cxx; | 
					
						
							|  |  |  |     this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX11; | 
					
						
							|  |  |  |     this->emptyProjectInfo.projectIncludeSearchPaths = {{"/include/bar", 2, IncludeSearchPathType::User}, | 
					
						
							|  |  |  |                                            {"/include/foo", 1, IncludeSearchPathType::User}}; | 
					
						
							|  |  |  |     this->emptyProjectInfo.systemIncludeSearchPaths = {{"/system/bar", 4, IncludeSearchPathType::System}, | 
					
						
							|  |  |  |                                           {"/system/foo", 3, IncludeSearchPathType::Framework}, | 
					
						
							|  |  |  |                                           {"/builtin/bar", 2, IncludeSearchPathType::BuiltIn}, | 
					
						
							|  |  |  |                                           {"/builtin/foo", 1, IncludeSearchPathType::BuiltIn}}; | 
					
						
							| 
									
										
										
										
											2019-04-24 14:07:39 +02:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                InputFileType::Header, | 
					
						
							|  |  |  |                                "/source/file.cpp", | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                ClangBackEnd::NativeFilePath{FilePath{"/resource/path"}}}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++-header", | 
					
						
							|  |  |  |                             "-std=c++11", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-01-30 09:07:45 +01:00
										 |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-04-24 14:07:39 +02:00
										 |  |  |                             "-isystem", | 
					
						
							|  |  |  |                             toNativePath("/resource/path"), | 
					
						
							| 
									
										
										
										
											2019-04-07 15:57:42 +02:00
										 |  |  |                             "-I", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/include/foo"), | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-I", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/include/bar"), | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-F", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/system/foo"), | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-isystem", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/system/bar"), | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-isystem", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/builtin/foo"), | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-isystem", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/builtin/bar"), | 
					
						
							|  |  |  |                             toNativePath("/source/file.cpp"))); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, EmptySourceFile) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, {}}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							|  |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++-header", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-04-24 14:07:39 +02:00
										 |  |  |                             "-nostdinc++")); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, SourceFile) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++-header", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-01-30 09:07:45 +01:00
										 |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.cpp"))); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, EmptyOutputFile) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp", ""}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++-header", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-01-30 09:07:45 +01:00
										 |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/source/file.cpp"))); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TYPED_TEST(CommandLineBuilder, OutputFile) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                InputFileType::Header, | 
					
						
							|  |  |  |                                "/source/file.cpp", | 
					
						
							|  |  |  |                                "/output/file.o"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++-header", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-01-30 09:07:45 +01:00
										 |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-o", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/output/file.o"), | 
					
						
							|  |  |  |                             toNativePath("/source/file.cpp"))); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-24 14:07:39 +02:00
										 |  |  | TYPED_TEST(CommandLineBuilder, PreIncludeSearchPath) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                ClangBackEnd::NativeFilePath{FilePath{"/resource/path"}}}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, Contains(toNativePath("/resource/path"))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | TYPED_TEST(CommandLineBuilder, IncludePchPath) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo, | 
					
						
							|  |  |  |                                {}, | 
					
						
							|  |  |  |                                InputFileType::Header, | 
					
						
							|  |  |  |                                "/source/file.cpp", | 
					
						
							|  |  |  |                                "/output/file.o", | 
					
						
							|  |  |  |                                "/pch/file.pch"}; | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++-header", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-01-30 09:07:45 +01:00
										 |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-Xclang", | 
					
						
							|  |  |  |                             "-include-pch", | 
					
						
							|  |  |  |                             "-Xclang", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/pch/file.pch"), | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  |                             "-o", | 
					
						
							| 
									
										
										
										
											2019-03-13 15:09:30 +01:00
										 |  |  |                             toNativePath("/output/file.o"), | 
					
						
							|  |  |  |                             toNativePath("/source/file.cpp"))); | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 18:54:48 +01:00
										 |  |  | TYPED_TEST(CommandLineBuilder, CompilerMacros) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-30 18:48:59 +01:00
										 |  |  |     this->emptyProjectInfo.compilerMacros = {{"YI", "1", 2}, {"ER", "2", 1}, {"SAN"}}; | 
					
						
							| 
									
										
										
										
											2019-01-23 18:54:48 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Builder<TypeParam> builder{this->emptyProjectInfo}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.commandLine, | 
					
						
							|  |  |  |                 ElementsAre("clang++", | 
					
						
							| 
									
										
										
										
											2019-02-28 19:22:22 +01:00
										 |  |  |                             "-w", | 
					
						
							| 
									
										
										
										
											2019-02-13 13:37:24 +01:00
										 |  |  |                             "-DNOMINMAX", | 
					
						
							| 
									
										
										
										
											2019-01-23 18:54:48 +01:00
										 |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++-header", | 
					
						
							|  |  |  |                             "-std=c++98", | 
					
						
							|  |  |  |                             "-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-01-30 09:07:45 +01:00
										 |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-01-23 18:54:48 +01:00
										 |  |  |                             "-DER=2", | 
					
						
							| 
									
										
										
										
											2019-04-24 14:07:39 +02:00
										 |  |  |                             "-DYI=1")); | 
					
						
							| 
									
										
										
										
											2019-01-23 18:54:48 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2019-01-30 13:59:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-17 12:06:57 +01:00
										 |  |  | } // namespace
 |