davisp commented on a change in pull request #610: Optimize ddoc cache URL: https://github.com/apache/couchdb/pull/610#discussion_r129150710
########## File path: src/ddoc_cache/test/ddoc_cache_coverage_test.erl ########## @@ -0,0 +1,77 @@ +% 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. + +-module(ddoc_cache_coverage_test). + + +-include_lib("couch/include/couch_db.hrl"). +-include_lib("eunit/include/eunit.hrl"). +-include("ddoc_cache_test.hrl"). + + +coverage_test_() -> + { + setup, + fun ddoc_cache_tutil:start_couch/0, + fun ddoc_cache_tutil:stop_couch/1, + [ + fun restart_lru/0, + fun stop_on_evictor_death/0 + ] + }. + + +restart_lru() -> + send_bad_messages(ddoc_cache_lru), + ?assertEqual(ok, ddoc_cache_lru:terminate(bang, {st, a, b, c})), + ?assertEqual({ok, foo}, ddoc_cache_lru:code_change(1, foo, [])). + + +stop_on_evictor_death() -> + meck:new(ddoc_cache_ev, [passthrough]), + try + Lru = whereis(ddoc_cache_lru), + State = sys:get_state(Lru), Review comment: Its a test testing internals for code coverage so it'll be hard to get away from relying on them. ;) Given that we're assigning all the extracted values to named variables I don't see how adding an API is doing anything more than just adding unnecessary code. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
