make compatible with more strict consteval format requirements of C++20

This commit is contained in:
Axel Kohlmeyer
2025-02-21 21:54:28 -05:00
parent 1e078665f6
commit b77c3bf8c7
2 changed files with 40 additions and 28 deletions

View File

@ -415,19 +415,19 @@ TEST_F(SimpleCommandsTest, Plugin)
if (!bindir) GTEST_SKIP() << "LAMMPS_PLUGIN_DIR not set";
std::string loadfmt = "plugin load {}/{}plugin.so";
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, bindir, "hello"));
lmp->input->one(fmt::format(fmt::runtime(loadfmt), bindir, "hello"));
auto text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, ContainsRegex(".*\n.*Loading plugin: Hello world command.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, bindir, "xxx"));
lmp->input->one(fmt::format(fmt::runtime(loadfmt), bindir, "xxx"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, ContainsRegex(".*Open of file .*xxx.* failed.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, bindir, "nve2"));
lmp->input->one(fmt::format(fmt::runtime(loadfmt), bindir, "nve2"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, ContainsRegex(".*Loading plugin: NVE2 variant fix style.*"));
@ -438,7 +438,7 @@ TEST_F(SimpleCommandsTest, Plugin)
ASSERT_THAT(text, ContainsRegex(".*1: command style plugin hello\n.*2: fix style plugin nve2.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, bindir, "hello"));
lmp->input->one(fmt::format(fmt::runtime(loadfmt), bindir, "hello"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, ContainsRegex(".*Ignoring load of command style hello: "