[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:43:52 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe8d955f29de7: [FormatManager] Add a unittest for GetCandidateLanguages() (authored by davide).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71299/new/

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.233188.patch
Type: text/x-patch
Size: 2994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191210/55752e28/attachment-0001.bin>


More information about the lldb-commits mailing list