[Lldb-commits] [lldb] 82dbf4a - [lldb/test] Move "DataFormatters/Mock.h" to "Plugins/Language/ObjC/Utilities.h"
Vedant Kumar via lldb-commits
lldb-commits at lists.llvm.org
Tue May 19 16:09:51 PDT 2020
Author: Vedant Kumar
Date: 2020-05-19T16:09:42-07:00
New Revision: 82dbf4aca84ec889d0dc390674ff44e30441bcfd
URL: https://github.com/llvm/llvm-project/commit/82dbf4aca84ec889d0dc390674ff44e30441bcfd
DIFF: https://github.com/llvm/llvm-project/commit/82dbf4aca84ec889d0dc390674ff44e30441bcfd.diff
LOG: [lldb/test] Move "DataFormatters/Mock.h" to "Plugins/Language/ObjC/Utilities.h"
This addresses some post-commit review feedback from
https://reviews.llvm.org/D80150 by renaming "Mock.h" to something less
misleading, and keeping logic related to the ObjC plugin separate from
the generic DataFormatters library.
Added:
lldb/source/Plugins/Language/ObjC/Utilities.h
lldb/unittests/Language/ObjC/CMakeLists.txt
lldb/unittests/Language/ObjC/UtilitiesTests.cpp
Modified:
lldb/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/unittests/DataFormatter/CMakeLists.txt
lldb/unittests/Language/CMakeLists.txt
Removed:
lldb/include/lldb/DataFormatters/Mock.h
lldb/unittests/DataFormatter/MockTests.cpp
################################################################################
diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
index 37b352263260..5128f2865879 100644
--- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -8,12 +8,12 @@
#include "Cocoa.h"
+#include "Plugins/Language/ObjC/Utilities.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/DataFormatters/FormattersHelpers.h"
-#include "lldb/DataFormatters/Mock.h"
#include "lldb/DataFormatters/StringPrinter.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/Host/Time.h"
diff --git a/lldb/include/lldb/DataFormatters/Mock.h b/lldb/source/Plugins/Language/ObjC/Utilities.h
similarity index 73%
rename from lldb/include/lldb/DataFormatters/Mock.h
rename to lldb/source/Plugins/Language/ObjC/Utilities.h
index b3fc10cd2e51..4cfeb2b28bfd 100644
--- a/lldb/include/lldb/DataFormatters/Mock.h
+++ b/lldb/source/Plugins/Language/ObjC/Utilities.h
@@ -1,4 +1,4 @@
-//===-- Mock.h --------------------------------------------------*- C++ -*-===//
+//===-- Utilities.h ---------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_DATAFORMATTERS_MOCK_H
-#define LLDB_DATAFORMATTERS_MOCK_H
+#ifndef LLDB_PLUGINS_LANGUAGE_OBJC_UTILITIES_H
+#define LLDB_PLUGINS_LANGUAGE_OBJC_UTILITIES_H
namespace lldb_private {
@@ -23,4 +23,4 @@ bool FormatDateValue(double date_value, Stream &stream);
} // namespace formatters
} // namespace lldb_private
-#endif // LLDB_DATAFORMATTERS_MOCK_H
+#endif // LLDB_PLUGINS_LANGUAGE_OBJC_UTILITIES_H
diff --git a/lldb/unittests/DataFormatter/CMakeLists.txt b/lldb/unittests/DataFormatter/CMakeLists.txt
index 716c8e735287..45011c56b0b0 100644
--- a/lldb/unittests/DataFormatter/CMakeLists.txt
+++ b/lldb/unittests/DataFormatter/CMakeLists.txt
@@ -1,6 +1,5 @@
add_lldb_unittest(LLDBFormatterTests
FormatManagerTests.cpp
- MockTests.cpp
StringPrinterTests.cpp
LINK_LIBS
diff --git a/lldb/unittests/Language/CMakeLists.txt b/lldb/unittests/Language/CMakeLists.txt
index 3a6e5de785e5..51421bd84984 100644
--- a/lldb/unittests/Language/CMakeLists.txt
+++ b/lldb/unittests/Language/CMakeLists.txt
@@ -1,2 +1,3 @@
add_subdirectory(CPlusPlus)
add_subdirectory(Highlighting)
+add_subdirectory(ObjC)
diff --git a/lldb/unittests/Language/ObjC/CMakeLists.txt b/lldb/unittests/Language/ObjC/CMakeLists.txt
new file mode 100644
index 000000000000..e61ced1d5bfb
--- /dev/null
+++ b/lldb/unittests/Language/ObjC/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_lldb_unittest(LanguageObjCTests
+ UtilitiesTests.cpp
+
+ LINK_LIBS
+ lldbPluginObjCLanguage
+ )
diff --git a/lldb/unittests/DataFormatter/MockTests.cpp b/lldb/unittests/Language/ObjC/UtilitiesTests.cpp
similarity index 84%
rename from lldb/unittests/DataFormatter/MockTests.cpp
rename to lldb/unittests/Language/ObjC/UtilitiesTests.cpp
index f7daaf22d140..b28060973d86 100644
--- a/lldb/unittests/DataFormatter/MockTests.cpp
+++ b/lldb/unittests/Language/ObjC/UtilitiesTests.cpp
@@ -1,4 +1,4 @@
-//===-- MockTests.cpp -----------------------------------------------------===//
+//===-- UtilitiesTests.cpp ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/Mock.h"
+#include "Plugins/Language/ObjC/Utilities.h"
#include "lldb/Utility/StreamString.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
@@ -25,7 +25,8 @@ static llvm::Optional<std::string> formatDateValue(double date_value) {
}
TEST(DataFormatterMockTest, NSDate) {
- EXPECT_EQ(*formatDateValue(-63114076800), "0001-12-30 00:00:00 +0000");
+ EXPECT_EQ(formatDateValue(-63114076800),
+ std::string("0001-12-30 00:00:00 +0000"));
// Can't convert the date_value to a time_t.
EXPECT_EQ(formatDateValue((double)(std::numeric_limits<time_t>::max()) + 1),
@@ -34,8 +35,10 @@ TEST(DataFormatterMockTest, NSDate) {
llvm::None);
// Can't add the macOS epoch to the converted date_value (the add overflows).
- EXPECT_EQ(formatDateValue((double)std::numeric_limits<time_t>::max()), llvm::None);
- EXPECT_EQ(formatDateValue((double)std::numeric_limits<time_t>::min()), llvm::None);
+ EXPECT_EQ(formatDateValue((double)std::numeric_limits<time_t>::max()),
+ llvm::None);
+ EXPECT_EQ(formatDateValue((double)std::numeric_limits<time_t>::min()),
+ llvm::None);
// FIXME: The formatting result is wrong on Windows because we adjust the
// epoch when _WIN32 is defined (see GetOSXEpoch).
More information about the lldb-commits
mailing list