summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2017-02-06 11:03:51 +0100
committerNikolai Kosjar <nikolai.kosjar@qt.io>2017-02-06 14:31:49 +0000
commit50a07695bdd8018f1af357a0745bc103a36312d3 (patch)
tree89363e9dc34efb93776014f43bdf2caef9edab3a /tests/unit
parent6244168202db3649a0a7e23a0e6acdba6ec074a5 (diff)
downloadqt-creator-50a07695bdd8018f1af357a0745bc103a36312d3.tar.gz
CppTools: Report also C language back to project
...for Project::setProjectLanguage(). Change-Id: I77347c4597061fb48782c629d5ad6898028fee13 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/unittest/cppbaseprojectpartbuilder-test.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unit/unittest/cppbaseprojectpartbuilder-test.cpp b/tests/unit/unittest/cppbaseprojectpartbuilder-test.cpp
index 68cfd629c7..cb2108658d 100644
--- a/tests/unit/unittest/cppbaseprojectpartbuilder-test.cpp
+++ b/tests/unit/unittest/cppbaseprojectpartbuilder-test.cpp
@@ -34,6 +34,7 @@
#include <projectexplorer/headerpath.h>
#include <projectexplorer/project.h>
+#include <projectexplorer/projectexplorerconstants.h>
#include <utils/mimetypes/mimedatabase.h>
@@ -48,6 +49,7 @@ using CppTools::ProjectPart;
using CppTools::ToolChainInterface;
using CppTools::ToolChainInterfacePtr;
+using testing::Contains;
using testing::Eq;
using testing::UnorderedElementsAre;
using testing::PrintToString;
@@ -215,6 +217,24 @@ TEST_F(BaseProjectPartBuilder, ProjectFileKindsMatchProjectPartVersion)
IsProjectPart(ProjectPart::LatestCxxVersion, ProjectFile::ObjCXXHeader)));
}
+TEST_F(BaseProjectPartBuilder, ReportsCxxLanguage)
+{
+ ::BaseProjectPartBuilder builder(new EditableProject, projectInfo);
+
+ const QList<Core::Id> languages = builder.createProjectPartsForFiles(QStringList() << "foo.cpp");
+
+ ASSERT_THAT(languages, Eq(QList<Core::Id>() << ProjectExplorer::Constants::CXX_LANGUAGE_ID));
+}
+
+TEST_F(BaseProjectPartBuilder, ReportsCLanguage)
+{
+ ::BaseProjectPartBuilder builder(new EditableProject, projectInfo);
+
+ const QList<Core::Id> languages = builder.createProjectPartsForFiles(QStringList() << "foo.c");
+
+ ASSERT_THAT(languages, Eq(QList<Core::Id>() << ProjectExplorer::Constants::C_LANGUAGE_ID));
+}
+
void BaseProjectPartBuilder::SetUp()
{
ASSERT_TRUE(MimeDataBaseUtilities::addCppToolsMimeTypes());