From 5d8d52763989f8839644d64791ea0a47f2b28799 Mon Sep 17 00:00:00 2001 From: ipknHama Date: Thu, 19 Feb 2015 12:16:28 +0900 Subject: add run-time check for handler type for `route_dynamic` --- tests/unittest.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/unittest.cpp b/tests/unittest.cpp index a133bce..460abac 100644 --- a/tests/unittest.cpp +++ b/tests/unittest.cpp @@ -1060,14 +1060,34 @@ TEST(route_dynamic) res.end(); }); - - app.route_dynamic("/set_int/") ([&](int y){ x = y; return ""; }); + try + { + app.route_dynamic("/invalid_test//") + ([](){ + return ""; + }); + fail(); + } + catch(std::exception&) + { + } + + // app is in an invalid state when route_dynamic throws an exception. + try + { + app.validate(); + fail(); + } + catch(std::exception&) + { + } + { request req; response res; -- cgit v1.2.3-54-g00ecf