couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxepal <>
Subject [GitHub] couchdb-chttpd pull request: Dynamic endpoints handlers
Date Sun, 30 Nov 2014 10:17:53 GMT
Github user kxepal commented on a diff in the pull request:
    --- 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
    +%% 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.
    +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 or file a JIRA ticket
with INFRA.

View raw message