From ba6d3ea5d431267e4ff8f48986e3bd9e297c4fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Gil=20de=20G=C3=B3mez=20P=C3=A9rez?= Date: Wed, 12 Aug 2026 14:07:12 +0300 Subject: [PATCH] Update: Changed contract violation handler to be able to test contract violations with Google Test --- support/contract_handler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support/contract_handler.cpp b/support/contract_handler.cpp index d53faff..81c932d 100644 --- a/support/contract_handler.cpp +++ b/support/contract_handler.cpp @@ -1,6 +1,8 @@ #include +#include #include -void handle_contract_violation(const std::contracts::contract_violation&) { +[[maybe_unused]] static void handle_contract_violation(const std::contracts::contract_violation& violation) { + std::fprintf(stderr, "contract violation: %s\n", violation.comment()); std::abort(); }