You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2019/12/25 17:45:21 UTC

[couchdb] 18/41: Speedup eunit: couch_httpd

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch speedup-test-suite
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 1b4e2c1b2807c2a7f7bf37fda938fdb2c1fd8c5a
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed Dec 25 11:31:36 2019 -0600

    Speedup eunit: couch_httpd
---
 src/couch/src/couch_httpd.erl | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index 65291e3..872b556 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -1263,8 +1263,8 @@ maybe_add_default_headers_test_() ->
     {"Tests adding default headers", Tests}.
 
 log_request_test_() ->
-    {foreachx,
-        fun(_) ->
+    {setup,
+        fun() ->
             ok = meck:new([couch_log]),
             ok = meck:expect(couch_log, error, fun(Fmt, Args) ->
                 case catch io_lib_format:fwrite(Fmt, Args) of
@@ -1273,13 +1273,16 @@ log_request_test_() ->
                 end
             end)
         end,
-        fun(_, _) ->
-            meck:unload([couch_log])
+        fun(_) ->
+            meck:unload()
         end,
-        [{Flag, fun should_accept_code_and_message/2} || Flag <- [true, false]]
+        [
+            fun() -> should_accept_code_and_message(true) end,
+            fun() -> should_accept_code_and_message(false) end
+        ]
     }.
 
-should_accept_code_and_message(DontLogFlag, _) ->
+should_accept_code_and_message(DontLogFlag) ->
     erlang:put(dont_log_response, DontLogFlag),
     {"with dont_log_response = " ++ atom_to_list(DontLogFlag),
         [