From 1a345a720f728438d0884c3ade4aa37d5c994701 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Mon, 24 Apr 2023 15:48:55 +0200 Subject: fixed dashboard file serving bug (#255) a recent change which introduced support for specifying accept: implicitly via the file extension in the URI caused fallout in the dashboard which would fail to serve any content because the extension was stripped from the RelativeUri accessor. This change fixes that by retaining a copy of the Uri string view which includes the suffix additionally, in order to test this change with both asio/http.sys paths I made the path used for all tests configurable in zenserver-test which involved pulling in a change from sb/proto which makes testing configuration a bit more flexible --- zencore/testing.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 zencore/testing.cpp (limited to 'zencore/testing.cpp') diff --git a/zencore/testing.cpp b/zencore/testing.cpp new file mode 100644 index 000000000..15be4b716 --- /dev/null +++ b/zencore/testing.cpp @@ -0,0 +1,52 @@ +#include "zencore/testing.h" +#include "zencore/logging.h" + +#if ZEN_WITH_TESTS + +namespace zen::testing { + +using namespace std::literals; + +struct TestRunner::Impl +{ + doctest::Context Session; +}; + +TestRunner::TestRunner() +{ + m_Impl = std::make_unique(); +} + +TestRunner::~TestRunner() +{ +} + +int +TestRunner::ApplyCommandLine(int argc, char const* const* argv) +{ + m_Impl->Session.applyCommandLine(argc, argv); + + for (int i = 1; i < argc; ++i) + { + if (argv[i] == "--debug"sv) + { + spdlog::set_level(spdlog::level::debug); + } + } + + return 0; +} + +int +TestRunner::Run() +{ + int Rv = 0; + + m_Impl->Session.run(); + + return Rv; +} + +} // namespace zen::testing + +#endif -- cgit v1.2.3