diff options
author | Hodlinator <172445034+hodlinator@users.noreply.github.com> | 2024-12-06 21:45:18 +0100 |
---|---|---|
committer | Hodlinator <172445034+hodlinator@users.noreply.github.com> | 2024-12-06 21:45:18 +0100 |
commit | b81a4659950a6c4e22316f66b55cae8afc4f4d9a (patch) | |
tree | 1f1412ed1fd0d079b3d8004a3b119d09e5e03e21 /src | |
parent | 083770adbe7db80d84f2634c8a53403d2f47b55b (diff) |
refactor test: Profit from using namespace + using detail function
Also adds BOOST_CHECK_NO_THROW() while touching that line, clarifying part of what we are checking for.
Also removed redundant inline from template functions in .cpp file.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/util_string_tests.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/test/util_string_tests.cpp b/src/test/util_string_tests.cpp index fbab9e7aba..eaf179f640 100644 --- a/src/test/util_string_tests.cpp +++ b/src/test/util_string_tests.cpp @@ -8,21 +8,22 @@ #include <test/util/setup_common.h> using namespace util; +using util::detail::CheckNumFormatSpecifiers; BOOST_AUTO_TEST_SUITE(util_string_tests) // Helper to allow compile-time sanity checks while providing the number of // args directly. Normally PassFmt<sizeof...(Args)> would be used. template <unsigned NumArgs> -inline void PassFmt(util::ConstevalFormatString<NumArgs> fmt) +void PassFmt(ConstevalFormatString<NumArgs> fmt) { // Execute compile-time check again at run-time to get code coverage stats - util::detail::CheckNumFormatSpecifiers<NumArgs>(fmt.fmt); + BOOST_CHECK_NO_THROW(CheckNumFormatSpecifiers<NumArgs>(fmt.fmt)); } template <unsigned WrongNumArgs> -inline void FailFmtWithError(const char* wrong_fmt, std::string_view error) +void FailFmtWithError(const char* wrong_fmt, std::string_view error) { - BOOST_CHECK_EXCEPTION(util::detail::CheckNumFormatSpecifiers<WrongNumArgs>(wrong_fmt), const char*, HasReason{error}); + BOOST_CHECK_EXCEPTION(CheckNumFormatSpecifiers<WrongNumArgs>(wrong_fmt), const char*, HasReason{error}); } BOOST_AUTO_TEST_CASE(ConstevalFormatString_NumSpec) |