[Lldb-commits] [PATCH] D71299: [FormatManager] Add a unittest for GetCandidateLanguages()
Davide Italiano via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 10 13:42:14 PST 2019
davide created this revision.
davide added reviewers: teemperor, JDevlieghere, aprantl, jingham.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.
JDevlieghere accepted this revision.
This revision is now accepted and ready to land.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71299
Files:
lldb/unittests/CMakeLists.txt
lldb/unittests/DataFormatter/CMakeLists.txt
lldb/unittests/DataFormatter/FormatManagerTests.cpp
Index: lldb/unittests/DataFormatter/FormatManagerTests.cpp
===================================================================
--- /dev/null
+++ lldb/unittests/DataFormatter/FormatManagerTests.cpp
@@ -0,0 +1,49 @@
+//===-- FormatManagerTests.cpp ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "TestingSupport/TestUtilities.h"
+
+#include "lldb/Core/Mangled.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/DataFormatters/FormatManager.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/SymbolContext.h"
+
+#include "llvm/Support/FileUtilities.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Program.h"
+#include "llvm/Testing/Support/Error.h"
+
+#include "gtest/gtest.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+TEST(FormatManagerTests, CompatibleLangs) {
+ std::vector<LanguageType> candidates = {eLanguageTypeC_plus_plus,
+ eLanguageTypeObjC};
+ EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC), candidates);
+ EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC89), candidates);
+ EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC99), candidates);
+ EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC11), candidates);
+
+ EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC_plus_plus),
+ candidates);
+ EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC_plus_plus_03),
+ candidates);
+ EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC_plus_plus_11),
+ candidates);
+ EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC_plus_plus_14),
+ candidates);
+
+ candidates = {eLanguageTypeObjC};
+ EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeObjC),
+ candidates);
+}
Index: lldb/unittests/DataFormatter/CMakeLists.txt
===================================================================
--- /dev/null
+++ lldb/unittests/DataFormatter/CMakeLists.txt
@@ -0,0 +1,13 @@
+add_lldb_unittest(LLDBFormatterTests
+ FormatManagerTests.cpp
+
+ LINK_LIBS
+ lldbCore
+ lldbInterpreter
+ lldbSymbol
+ lldbTarget
+ lldbUtility
+
+ LINK_COMPONENTS
+ Support
+ )
Index: lldb/unittests/CMakeLists.txt
===================================================================
--- lldb/unittests/CMakeLists.txt
+++ lldb/unittests/CMakeLists.txt
@@ -61,6 +61,7 @@
add_subdirectory(TestingSupport)
add_subdirectory(Breakpoint)
add_subdirectory(Core)
+add_subdirectory(DataFormatter)
add_subdirectory(Disassembler)
add_subdirectory(Editline)
add_subdirectory(Expression)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71299.233184.patch
Type: text/x-patch
Size: 2994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191210/c75f0324/attachment.bin>
More information about the lldb-commits
mailing list