aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/ErrorTest.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2021-09-08 16:16:11 -0700
committerDavid Blaikie <dblaikie@gmail.com>2021-09-08 16:16:54 -0700
commitf03689ace598b2c5f8263bbc5afbc4e5bc33ac43 (patch)
tree29db9c0081a5bc790924222f2694fc4d2ea7675d /llvm/unittests/Support/ErrorTest.cpp
parent0c502507f4627f72eeecbb5e78c2f9c1cb8f9219 (diff)
downloadllvm-f03689ace598b2c5f8263bbc5afbc4e5bc33ac43.zip
llvm-f03689ace598b2c5f8263bbc5afbc4e5bc33ac43.tar.gz
llvm-f03689ace598b2c5f8263bbc5afbc4e5bc33ac43.tar.bz2
FileError: Provide a way to retrieve the underlying error string without the file name
For use with APIs that want to report the file name in a different syntactic form, have other knowledge of the filename, etc.
Diffstat (limited to 'llvm/unittests/Support/ErrorTest.cpp')
-rw-r--r--llvm/unittests/Support/ErrorTest.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
index 9356402..d4d3302 100644
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -958,8 +958,13 @@ TEST(Error, FileErrorTest) {
"'file2.bin': CustomError {42}"),
0);
- Error FE5 = createFileError("", make_error<CustomError>(1));
- EXPECT_EQ(toString(std::move(FE5)).compare("'': CustomError {1}"), 0);
+ Error FE5 = createFileError("", make_error<CustomError>(5));
+ EXPECT_EQ(toString(std::move(FE5)).compare("'': CustomError {5}"), 0);
+
+ Error FE6 = createFileError("unused", make_error<CustomError>(6));
+ handleAllErrors(std::move(FE6), [](std::unique_ptr<FileError> F) {
+ EXPECT_EQ(F->messageWithoutFileInfo(), "CustomError {6}");
+ });
}
enum class test_error_code {