Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-chttpd/pull/10#discussion_r21059267
--- Diff: test/chttpd_handler_callback_test.erl ---
@@ -0,0 +1,266 @@
+%% Licensed under the Apache License, Version 2.0 (the "License"); you
may not
+%% use this file except in compliance with the License. You may obtain a
copy of
+%% the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing,
software
+%% distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
+%% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the
+%% License for the specific language governing permissions and limitations
under
+%% the License.
+%%
+%% @doc
+%% These whitebox tests call the endpoints that are implemented by dynamic
funs,
+%% which replace the previously hardwired handlers, with a dynamically
created
+%% module. This test mocks everything except the proper relationship
between
+%% handler function clause and returned fun. The handler functions are
called
+%% directly.
+%%
+%% This can look like mocks testing themselves. In this case, in other
words:
+%% think of the former url_handler function in chttpd.erl: The relationship
+%% between a function clause and the specific returned fun() is exactly
what is
+%% established by the dynamically created module. And it's precisely what
this
+%% test verifies, for every endpoint.
+%%
+%% This test was part of chttpd-cloudant dbcore-2.7.7, verifying the
original
+%% hardcoded endpoints. It has since been reworked but remains functionally
+%% mostly identical; the config source and processing has been replaced.
+
+-module(chttpd_handler_callback_test).
+
+-include_lib("eunit/include/eunit.hrl").
+
+all_test_() ->
+ io:format(user, "~nEndpoint handler callbacks:~n", []),
--- End diff --
If you need print something to stdout for debug proposes use ?debug macro.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---