Github user hdiedrich commented on a diff in the pull request:

    https://github.com/apache/couchdb-chttpd/pull/10#discussion_r21085923
  
    --- 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", []),
    +    {setup,
    +    fun() -> chttpd_handler:build(test_cfg()) end,
    +    [
    --- End diff --
    
    Thanks for the review!
    
    Do you mean: replacing the individual test functions, e.g. changing  
    ```erlang
         fun() -> 
             assertReturns("", chttpd_misc, handle_welcome_req) 
         end,
    ```
    to something like `test_chttpd_misc_handle_welcome_req/1` with a separate 
definition in the module body  
    ```erlang
         test_chttpd_misc_handle_welcome_req() -> 
             assertReturns("", chttpd_misc, handle_welcome_req) 
         end.
    ```



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to