summaryrefslogtreecommitdiff
path: root/unittests/Core
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Core')
-rw-r--r--unittests/Core/CMakeLists.txt1
-rw-r--r--unittests/Core/ErrorTest.cpp19
2 files changed, 20 insertions, 0 deletions
diff --git a/unittests/Core/CMakeLists.txt b/unittests/Core/CMakeLists.txt
index da880010e4be..980bc5b9f9ae 100644
--- a/unittests/Core/CMakeLists.txt
+++ b/unittests/Core/CMakeLists.txt
@@ -2,6 +2,7 @@ add_lldb_unittest(LLDBCoreTests
ArchSpecTest.cpp
BroadcasterTest.cpp
DataExtractorTest.cpp
+ ErrorTest.cpp
ListenerTest.cpp
ScalarTest.cpp
StructuredDataTest.cpp
diff --git a/unittests/Core/ErrorTest.cpp b/unittests/Core/ErrorTest.cpp
new file mode 100644
index 000000000000..f3727bbd78ae
--- /dev/null
+++ b/unittests/Core/ErrorTest.cpp
@@ -0,0 +1,19 @@
+//===-- ErrorTest.cpp -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+#include "lldb/Core/Error.h"
+
+using namespace lldb_private;
+
+TEST(ErrorTest, Formatv) {
+ EXPECT_EQ("", llvm::formatv("{0}", Error()).str());
+ EXPECT_EQ("Hello Error", llvm::formatv("{0}", Error("Hello Error")).str());
+ EXPECT_EQ("Hello", llvm::formatv("{0:5}", Error("Hello Error")).str());
+}