[llvm] [orc-rt] Use the Error matchers in CallSPSCITest (PR #228353)
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 00:28:22 PDT 2026
https://github.com/lhames created https://github.com/llvm/llvm-project/pull/228353
Use the Error matchers introduced in 4c8a437d0487 to clean up error checks in CallSPSCITest.
>From 711c7d234fd71a311a7a55db38c8c6c2ef7f5758 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Thu, 1 Oct 2026 09:28:40 +1000
Subject: [PATCH] [orc-rt] Use the Error matchers in CallSPSCITest
Use the Error matchers introduced in 4c8a437d0487 to clean up error
checks in CallSPSCITest.
---
orc-rt/test/unit/bedrock/sps/CallSPSCITest.cpp | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/orc-rt/test/unit/bedrock/sps/CallSPSCITest.cpp b/orc-rt/test/unit/bedrock/sps/CallSPSCITest.cpp
index 41354ed71cf35..f7c2d46ade226 100644
--- a/orc-rt/test/unit/bedrock/sps/CallSPSCITest.cpp
+++ b/orc-rt/test/unit/bedrock/sps/CallSPSCITest.cpp
@@ -14,6 +14,7 @@
#include "orc-rt/support/sps/SPSWrapperFunction.h"
#include "DirectCaller.h"
+#include "ErrorMatchers.h"
#include "gtest/gtest.h"
#include <optional>
@@ -29,7 +30,7 @@ static DirectCaller caller(orc_rt_WrapperFunction Fn) { return {nullptr, Fn}; }
TEST(CallSPSCITest, Registration) {
SimpleSymbolTable CI;
- cantFail(sps_ci::addCall(CI));
+ ASSERT_THAT_ERROR(sps_ci::addCall(CI), Succeeded());
EXPECT_TRUE(CI.count(SymbolNameSpec::c("orc_rt_ci_sps_call_void_void")));
EXPECT_TRUE(CI.count(SymbolNameSpec::c("orc_rt_ci_sps_call_main")));
@@ -42,7 +43,7 @@ TEST(CallSPSCITest, CallVoidVoid) {
using SPSSig = void(SPSExecutorAddr);
SPSWrapperFunction<SPSSig>::call(
caller(orc_rt_ci_sps_call_void_void),
- [](Error Err) { cantFail(std::move(Err)); },
+ [](Error Err) { EXPECT_THAT_ERROR(std::move(Err), Succeeded()); },
reinterpret_cast<void *>(callVoidVoidFn));
EXPECT_EQ(CallVoidVoidCount, 1);
}
@@ -68,8 +69,7 @@ TEST(CallSPSCITest, CallMain) {
reinterpret_cast<void *>(callMainFn), Args);
ASSERT_TRUE(Result.has_value());
- ASSERT_TRUE(!!*Result) << toString(Result->takeError());
- EXPECT_EQ(**Result, 42);
+ EXPECT_THAT_EXPECTED(*Result, HasValue(42));
EXPECT_EQ(CallMainArgC, 3)
<< "argc should equal the number of program arguments, "
@@ -100,8 +100,7 @@ TEST(CallSPSCITest, CallMainEmptyArgV) {
reinterpret_cast<void *>(callMainEmptyArgVFn), Args);
ASSERT_TRUE(Result.has_value());
- ASSERT_TRUE(!!*Result) << toString(Result->takeError());
- EXPECT_EQ(**Result, 42);
+ EXPECT_THAT_EXPECTED(*Result, HasValue(42));
EXPECT_EQ(CallMainEmptyArgVArgC, 0);
EXPECT_TRUE(CallMainEmptyArgVIsNullTerminated);
}
More information about the llvm-commits
mailing list