Skip to content

Commit 4726527

Browse files
etrclaude
andcommitted
test(TASK-025): RED on_* lambda registration suite
Adds the eight-test compile-time + runtime suite for the new lambda registration entry points: hello-world (PRD §3.4), per-method 405 + Allow header, multi-method composition on a single path, all seven overloads dispatch their method, duplicate (method, path) throws, merge-then-conflict still throws, parameterized path binds {id}, and class-resource registration on a lambda-owned path throws. Pins the §4.7 detail::route_entry shape via static_assert. Compiles will fail until on_get/post/put/delete/patch/options/head and detail::route_entry land in GREEN. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 744187f commit 4726527

2 files changed

Lines changed: 394 additions & 1 deletion

File tree

test/Makefile.am

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ LDADD += -lcurl
2626

2727
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/httpserver/ -DHTTPSERVER_COMPILATION
2828
METASOURCES = AUTO
29-
check_PROGRAMS = basic file_upload http_utils threaded nodelay string_utilities http_endpoint ban_system ws_start_stop authentication deferred http_resource http_response create_webserver new_response_types daemon_info uri_log feature_unavailable header_hygiene_iovec header_hygiene iovec_entry http_method constants body http_response_sbo http_response_factories webserver_pimpl http_request_pimpl create_test_request http_request_arena http_request_const_getters http_request_tls_accessors webserver_register_smartptr webserver_register_path_prefix
29+
check_PROGRAMS = basic file_upload http_utils threaded nodelay string_utilities http_endpoint ban_system ws_start_stop authentication deferred http_resource http_response create_webserver new_response_types daemon_info uri_log feature_unavailable header_hygiene_iovec header_hygiene iovec_entry http_method constants body http_response_sbo http_response_factories webserver_pimpl http_request_pimpl create_test_request http_request_arena http_request_const_getters http_request_tls_accessors webserver_register_smartptr webserver_register_path_prefix webserver_on_methods
3030

3131
MOSTLYCLEANFILES = *.gcda *.gcno *.gcov
3232

@@ -168,6 +168,20 @@ webserver_register_smartptr_SOURCES = unit/webserver_register_smartptr_test.cpp
168168
# still serves and behaves like register_path.
169169
webserver_register_path_prefix_SOURCES = unit/webserver_register_path_prefix_test.cpp
170170

171+
# webserver_on_methods: TASK-025. Compile-time signature contract for
172+
# the seven on_* lambda registration overloads (on_get / on_post / on_put
173+
# / on_delete / on_patch / on_options / on_head) plus static_asserts on
174+
# the §4.7 detail::route_entry shape (method_set + variant<lambda_handler,
175+
# shared_ptr<http_resource>> + bool is_prefix). Runtime tests over real
176+
# curl round-trips: PRD §3.4 hello-world; per-method 405 + Allow header;
177+
# composition (on_get + on_post on the same path serve both); all seven
178+
# methods dispatch correctly; duplicate (method, path) registration
179+
# throws std::invalid_argument; merge-then-conflict still throws;
180+
# parameterized path binds {id}; class-resource registration on a
181+
# lambda-owned path throws. Default LDADD (libhttpserver + curl) is
182+
# sufficient.
183+
webserver_on_methods_SOURCES = unit/webserver_on_methods_test.cpp
184+
171185
noinst_HEADERS = littletest.hpp
172186
AM_CXXFLAGS += -Wall -fPIC -Wno-overloaded-virtual
173187

0 commit comments

Comments
 (0)