Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-chttpd/pull/102#discussion_r53270213
--- Diff: test/chttpd_db_test.erl ---
@@ -83,17 +83,19 @@ should_accept_live_as_an_alias_for_continuous(Url) ->
{ok, _, _, ResultBody} =
test_request:get(Url ++ "/_changes?feed=live&timeout=1",
[?AUTH]),
{ResultJson} = ?JSON_DECODE(ResultBody),
- <<LastSeqNum0:1/binary, "-", _/binary>> = couch_util:get_value(
- <<"last_seq">>, ResultJson, undefined),
- LastSeqNum = list_to_integer(binary_to_list(LastSeqNum0)),
+ LastSeqNum = seq_num(couch_util:get_value(<<"last_seq">>,
ResultJson)),
{ok, _, _, _} = create_doc(Url, "testdoc2"),
{ok, _, _, ResultBody2} =
test_request:get(Url ++ "/_changes?feed=live&timeout=1",
[?AUTH]),
[_, CleanedResult] = binary:split(ResultBody2, <<"\n">>),
{[{_, Seq}, _]} = ?JSON_DECODE(CleanedResult),
- <<SeqNum0:1/binary, "-", _/binary>> = Seq,
- SeqNum = list_to_integer(binary_to_list(SeqNum0)),
+ SeqNum = seq_num(Seq),
?assertEqual(LastSeqNum + 1, SeqNum)
end).
+
+seq_num(<<SeqNumBin:1/binary, "-", _/binary>>) ->
+ list_to_integer(binary_to_list(SeqNumBin));
--- End diff --
it's possible now to use `binary_to_integer` as our minimal supported
Erlang version is R16B03-1 which has it.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---