From 7226ebbfb40299519315ae2bea3b8208de33b945 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 16 May 2023 15:18:48 +0200 Subject: [PATCH] Improve error message when providing a wrong value to an InListVerifier --- include/openspace/documentation/verifier.inl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/openspace/documentation/verifier.inl b/include/openspace/documentation/verifier.inl index ff0a194f2b..4fc3cc9671 100644 --- a/include/openspace/documentation/verifier.inl +++ b/include/openspace/documentation/verifier.inl @@ -24,8 +24,10 @@ #include +#include #include #include +#include #include template <> @@ -750,6 +752,19 @@ TestResult InListVerifier::operator()(const ghoul::Dictionary& dict, TestResult::Offense o; o.offender = key; o.reason = TestResult::Offense::Reason::Verification; + + std::string list = std::accumulate( + values.begin() + 1, + values.end(), + fmt::format("{}", values.front()), + [](std::string lhs, typename T::Type rhs) { + return fmt::format("{}, {}", lhs, rhs); + } + ); + o.explanation = fmt::format( + "{} not in list of accepted values '{}'", + key, list + ); r.offenses.push_back(o); return r; }