From f1c5068ee8a5a7651294dd265dbad965c65246e0 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 17 Oct 2026 00:32:39 -0400 Subject: [PATCH] Build the tests that throw only with exceptions ThrowingVerifyCallbackRejectsTheCertificate and ErrorAndExceptionHandlersReplaceProvider throw from a callback, which does not compile with CPPHTTPLIB_NO_EXCEPTIONS and -fno-exceptions. --- test/test.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/test.cc b/test/test.cc index b2404457..8e416dbd 100644 --- a/test/test.cc +++ b/test/test.cc @@ -4906,6 +4906,7 @@ TEST(SSLClientServerTest, UpdateCertsPemReplacesClientCA) { EXPECT_FALSE(get()); } +#ifndef CPPHTTPLIB_NO_EXCEPTIONS TEST(SSLClientServerTest, ThrowingVerifyCallbackRejectsTheCertificate) { SSLServer svr(SERVER_CERT_FILE, SERVER_PRIVATE_KEY_FILE, CLIENT_CA_CERT_FILE); ASSERT_TRUE(svr.is_valid()); @@ -4945,6 +4946,7 @@ TEST(SSLClientServerTest, ThrowingVerifyCallbackRejectsTheCertificate) { ASSERT_TRUE(res) << "Error: " << to_string(res.error()); EXPECT_EQ("ok", res->body); } +#endif #ifdef CPPHTTPLIB_OPENSSL_SUPPORT // Sends each request over a new connection with a client certificate, @@ -13373,6 +13375,7 @@ TEST(ResponseContentSourceTest, FileRequestHandlerCanReplaceFile) { } } +#ifndef CPPHTTPLIB_NO_EXCEPTIONS TEST(ResponseContentSourceTest, ErrorAndExceptionHandlersReplaceProvider) { Server svr; @@ -13456,6 +13459,7 @@ TEST(ResponseContentSourceTest, ErrorAndExceptionHandlersReplaceProvider) { std::lock_guard guard(released_mutex); EXPECT_EQ((std::vector{false, false, false}), released); } +#endif TEST(ResponseContentSourceTest, LastContentSetterWins) { Server svr;