From 1d947597c678819ec2a03ffd34c3105f4b3c5f66 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 2 Feb 2024 11:54:57 -0700 Subject: [PATCH] Adjust a test. --- .../parameter_handler/parameter_handler_25.cc | 20 +++++++++++++++---- .../parameter_handler_25.output | 4 +--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/parameter_handler/parameter_handler_25.cc b/tests/parameter_handler/parameter_handler_25.cc index ee6aa106e3..4a2f8769f3 100644 --- a/tests/parameter_handler/parameter_handler_25.cc +++ b/tests/parameter_handler/parameter_handler_25.cc @@ -93,9 +93,17 @@ fail() } catch (const std::exception &exc) { + // Print everything after the "violated condition" part + // of the error message, assuming the condition is shown. + // If it isn't (because the condition was simply 'false' and + // so the error printing part suppresses this part), then + // show the part after "Additional information": std::string error = exc.what(); - auto start = error.find("The violated condition was:"); - if (start != std::string::npos) + if (auto start = error.find("The violated condition was:"); + start != std::string::npos) + deallog << error.substr(start) << std::endl; + else if (auto start = error.find("Additional information:"); + start != std::string::npos) deallog << error.substr(start) << std::endl; } @@ -106,9 +114,13 @@ fail() } catch (const std::exception &exc) { + // Same as above: std::string error = exc.what(); - auto start = error.find("The violated condition was:"); - if (start != std::string::npos) + if (auto start = error.find("The violated condition was:"); + start != std::string::npos) + deallog << error.substr(start) << std::endl; + else if (auto start = error.find("Additional information:"); + start != std::string::npos) deallog << error.substr(start) << std::endl; } } diff --git a/tests/parameter_handler/parameter_handler_25.output b/tests/parameter_handler/parameter_handler_25.output index d1f6e83ac4..fdd698c260 100644 --- a/tests/parameter_handler/parameter_handler_25.output +++ b/tests/parameter_handler/parameter_handler_25.output @@ -1,9 +1,7 @@ DEAL:: DEAL::successful -DEAL::The violated condition was: - false -Additional information: +DEAL::Additional information: You can't ask for entry you have not yet declared. -------------------------------------------------------- -- 2.39.5