nickva commented on a change in pull request #3553: URL: https://github.com/apache/couchdb/pull/3553#discussion_r632079503
########## File path: src/couch_eval/test/error_tests.erl ########## @@ -0,0 +1,53 @@ +% 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(error_tests). + +-include_lib("couch/include/couch_eunit.hrl"). +-include_lib("couch/include/couch_db.hrl"). + +-define(LANG_BINARY, <<"foo_lang">>). +-define(LANG_STRING, binary_to_list(?LANG_BINARY)). + + +setup() -> + meck:new(mock_language_server, [non_strict]), + Ctx = test_util:start_couch(), + config:set("couch_eval.languages", ?LANG_STRING, + atom_to_list(mock_language_server)), + Ctx. + + +teardown(Ctx) -> + test_util:stop_couch(Ctx), + meck:unload(). + + +error_test_() -> + { + "Error tests", + { + setup, + fun setup/0, fun teardown/1, + [ + fun acquire_map_context_error_handled/0 + ] + } + }. + +acquire_map_context_error_handled() -> + meck:expect(mock_language_server, acquire_map_context, + fun(_) -> {error, foo_error} end), + Result = couch_eval:acquire_map_context(<<"foo">>, <<"bar">>, ?LANG_BINARY, + <<"baz">>, <<"quux">>, [<<"quuz">>]), + ?assertEqual({error, foo_error}, Result). + Review comment: Minor formatting nit, let's use the standard 4 space indentation. [Emilio](https://github.com/cloudant-labs/emilio) can help us here ``` ~/src/emilio/emilio src/couch_eval/test/error_tests.erl src/couch_eval/test/error_tests.erl:23(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:24(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:25(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:27(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:31(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:32(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:36(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:39(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:40(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:41(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:43(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:45(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:45(5) - 302 - there should be 2 empty lines between functions, not 1 src/couch_eval/test/error_tests.erl:48(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:49(5) - 141 - inline fun does not start on call line src/couch_eval/test/error_tests.erl:50(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:52(1) - 111 - leading white space should be a multiple of 4 src/couch_eval/test/error_tests.erl:53(1) - 210 - file ends with 2 new lines, not 1 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
