aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2015-02-19 12:16:28 +0900
committeripknHama <ipknhama@gmail.com>2015-02-19 12:16:28 +0900
commit5d8d52763989f8839644d64791ea0a47f2b28799 (patch)
treef607871b4bd6df8f2753a336fb1b942ca6e1ab0d /tests
parentc8dbd421c9c4ab44533ba702901a9ce63851b5f1 (diff)
downloadcrow-5d8d52763989f8839644d64791ea0a47f2b28799.tar.gz
crow-5d8d52763989f8839644d64791ea0a47f2b28799.zip
add run-time check for handler type for `route_dynamic`
Diffstat (limited to 'tests')
-rw-r--r--tests/unittest.cpp24
1 files changed, 22 insertions, 2 deletions
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>")
([&](int y){
x = y;
return "";
});
+ try
+ {
+ app.route_dynamic("/invalid_test/<double>/<path>")
+ ([](){
+ 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;