mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-30 00:47:12 +00:00
f7bc18f528
Catch v2 changed the `run(...)` signature to take a `char *argv[]`, arguing partly that technically a `char *argv[]` type is the correct `main()` signature rather than `const char *argv[]`. Dropping the `const` here doesn't appear to cause any problems with catch v1 (tested against both the cmake-downloaded 1.9.3 and Debian's 1.12.1 package) so we can follow suit.
23 lines
637 B
C++
23 lines
637 B
C++
// The Catch implementation is compiled here. This is a standalone
|
|
// translation unit to avoid recompiling it for every test change.
|
|
|
|
#include <pybind11/embed.h>
|
|
|
|
#ifdef _MSC_VER
|
|
// Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to catch
|
|
// 2.0.1; this should be fixed in the next catch release after 2.0.1).
|
|
# pragma warning(disable: 4996)
|
|
#endif
|
|
|
|
#define CATCH_CONFIG_RUNNER
|
|
#include <catch.hpp>
|
|
|
|
namespace py = pybind11;
|
|
|
|
int main(int argc, char *argv[]) {
|
|
py::scoped_interpreter guard{};
|
|
auto result = Catch::Session().run(argc, argv);
|
|
|
|
return result < 0xff ? result : 0xff;
|
|
}
|