Fix unit_test fail doesn't result in error in CI (#270)
This commit is contained in:
@@ -205,10 +205,10 @@ struct DenseMapInfo<llvm::ArrayRef<const char*>> {
|
||||
|
||||
template <>
|
||||
struct std::formatter<clice::CompilationDatabase::QueryDriverError> :
|
||||
std::formatter<llvm::StringRef> {
|
||||
std::formatter<std::string_view> {
|
||||
|
||||
template <typename FormatContext>
|
||||
auto format(clice::CompilationDatabase::QueryDriverError& e, FormatContext& ctx) const {
|
||||
auto format(const clice::CompilationDatabase::QueryDriverError& e, FormatContext& ctx) const {
|
||||
return std::format_to(ctx.out(), "{} {}", e.kind.name(), e.detail);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -103,6 +103,7 @@ constexpr inline struct {
|
||||
std::source_location location = std::source_location::current()) const {
|
||||
bool failed = false;
|
||||
std::string expression = "false";
|
||||
std::string message;
|
||||
|
||||
if constexpr(is_expr_v<TExpr>) {
|
||||
auto result = expr();
|
||||
@@ -115,10 +116,20 @@ constexpr inline struct {
|
||||
} else {
|
||||
if(!static_cast<bool>(expr)) {
|
||||
failed = true;
|
||||
|
||||
if constexpr(requires { expr.error(); }) {
|
||||
message = std::format("{}", expr.error());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return may_failure{failed, false, expression, location};
|
||||
return may_failure{
|
||||
failed,
|
||||
false,
|
||||
std::move(expression),
|
||||
location,
|
||||
std::move(message),
|
||||
};
|
||||
}
|
||||
} expect;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user