eiri commented on a change in pull request #560: Fix broken eunit test in
changes_since_test_ test suite
URL: https://github.com/apache/couchdb/pull/560#discussion_r120673207
##########
File path: src/couch_mrview/src/couch_mrview_test_util.erl
##########
@@ -72,6 +72,53 @@ ddoc(changes) ->
]}}
]}}
]});
+ddoc({changes, keyseq_indexed}) ->
Review comment:
This is rather repetitive, to be honest, when we only want to change
options. How changing original `doc(changes)` to this:
```
ddoc({changes, Opts}) ->
ViewOpts = case Opts of
seq_indexed ->
[{<<"seq_indexed">>, true}];
keyseq_indexed ->
[{<<"keyseq_indexed">>, true}];
seq_indexed_keyseq_indexed ->
[
{<<"seq_indexed">>, true},
{<<"keyseq_indexed">>, true}
]
end,
couch_doc:from_json_obj({[
{<<"_id">>, <<"_design/bar">>},
{<<"options">>, {ViewOpts}},
{<<"views">>, {[
{<<"baz">>, {[
{<<"map">>, <<"function(doc) {emit(doc.val, doc.val);}">>}
]}}
]}}
]});
```
Same result, way less typing and it's a bit clearer on what's going on.
Also we don't need `bing` and `zing` since we don't use them in the tests.
----------------------------------------------------------------
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