From d07865846c7d31dd61111e6df801864327b65070 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 11 Feb 2022 20:37:09 -0800 Subject: [PATCH] After clang-format (via pre-commit). --- tests/test_class.cpp | 4 +-- tests/test_const_name.cpp | 68 +++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/tests/test_class.cpp b/tests/test_class.cpp index 11091afce..c8b8071dc 100644 --- a/tests/test_class.cpp +++ b/tests/test_class.cpp @@ -354,9 +354,7 @@ TEST_SUBMODULE(class_, m) { using ProtectedA::foo; }; - py::class_(m, "ProtectedA") - .def(py::init<>()) - .def("foo", &PublicistA::foo); + py::class_(m, "ProtectedA").def(py::init<>()).def("foo", &PublicistA::foo); class ProtectedB { public: diff --git a/tests/test_const_name.cpp b/tests/test_const_name.cpp index f1b13e276..2ad01e682 100644 --- a/tests/test_const_name.cpp +++ b/tests/test_const_name.cpp @@ -5,44 +5,44 @@ #include "pybind11_tests.h" // IUT = Implementation Under Test -# define CONST_NAME_TESTS(TEST_FUNC, IUT) \ - std::string TEST_FUNC(int selector) { \ - switch (selector) { \ - case 0: \ - return IUT("").text; \ - case 1: \ - return IUT("A").text; \ - case 2: \ - return IUT("Bd").text; \ - case 3: \ - return IUT("Cef").text; \ - case 4: \ - return IUT().text; /*NOLINT(bugprone-macro-parentheses)*/ \ - case 5: \ - return IUT().text; /*NOLINT(bugprone-macro-parentheses)*/ \ - case 6: \ - return IUT("T1", "T2").text; /*NOLINT(bugprone-macro-parentheses)*/ \ - case 7: \ - return IUT("U1", "U2").text; /*NOLINT(bugprone-macro-parentheses)*/ \ - case 8: \ - /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \ - return IUT(IUT("D1"), IUT("D2")).text; \ - case 9: \ - /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \ - return IUT(IUT("E1"), IUT("E2")).text; \ - case 10: \ - return IUT("KeepAtEnd").text; \ - default: \ - break; \ - } \ - throw std::runtime_error("Invalid selector value."); \ - } +#define CONST_NAME_TESTS(TEST_FUNC, IUT) \ + std::string TEST_FUNC(int selector) { \ + switch (selector) { \ + case 0: \ + return IUT("").text; \ + case 1: \ + return IUT("A").text; \ + case 2: \ + return IUT("Bd").text; \ + case 3: \ + return IUT("Cef").text; \ + case 4: \ + return IUT().text; /*NOLINT(bugprone-macro-parentheses)*/ \ + case 5: \ + return IUT().text; /*NOLINT(bugprone-macro-parentheses)*/ \ + case 6: \ + return IUT("T1", "T2").text; /*NOLINT(bugprone-macro-parentheses)*/ \ + case 7: \ + return IUT("U1", "U2").text; /*NOLINT(bugprone-macro-parentheses)*/ \ + case 8: \ + /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \ + return IUT(IUT("D1"), IUT("D2")).text; \ + case 9: \ + /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \ + return IUT(IUT("E1"), IUT("E2")).text; \ + case 10: \ + return IUT("KeepAtEnd").text; \ + default: \ + break; \ + } \ + throw std::runtime_error("Invalid selector value."); \ + } CONST_NAME_TESTS(const_name_tests, py::detail::const_name) -# ifdef PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY +#ifdef PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY CONST_NAME_TESTS(underscore_tests, py::detail::_) -# endif +#endif TEST_SUBMODULE(const_name, m) { m.def("const_name_tests", const_name_tests);