Skip to content

Commit b81a465

Browse files
committed
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.
1 parent 083770a commit b81a465

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/test/util_string_tests.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@
88
#include <test/util/setup_common.h>
99

1010
using namespace util;
11+
using util::detail::CheckNumFormatSpecifiers;
1112

1213
BOOST_AUTO_TEST_SUITE(util_string_tests)
1314

1415
// Helper to allow compile-time sanity checks while providing the number of
1516
// args directly. Normally PassFmt<sizeof...(Args)> would be used.
1617
template <unsigned NumArgs>
17-
inline void PassFmt(util::ConstevalFormatString<NumArgs> fmt)
18+
void PassFmt(ConstevalFormatString<NumArgs> fmt)
1819
{
1920
// Execute compile-time check again at run-time to get code coverage stats
20-
util::detail::CheckNumFormatSpecifiers<NumArgs>(fmt.fmt);
21+
BOOST_CHECK_NO_THROW(CheckNumFormatSpecifiers<NumArgs>(fmt.fmt));
2122
}
2223
template <unsigned WrongNumArgs>
23-
inline void FailFmtWithError(const char* wrong_fmt, std::string_view error)
24+
void FailFmtWithError(const char* wrong_fmt, std::string_view error)
2425
{
25-
BOOST_CHECK_EXCEPTION(util::detail::CheckNumFormatSpecifiers<WrongNumArgs>(wrong_fmt), const char*, HasReason{error});
26+
BOOST_CHECK_EXCEPTION(CheckNumFormatSpecifiers<WrongNumArgs>(wrong_fmt), const char*, HasReason{error});
2627
}
2728

2829
BOOST_AUTO_TEST_CASE(ConstevalFormatString_NumSpec)

0 commit comments

Comments
 (0)