You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2018/06/22 22:15:43 UTC
[couchdb] 14/31: Embrace the Elixir
This is an automated email from the ASF dual-hosted git repository.
chewbranca pushed a commit to branch elixir-suite
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 3667d8f26763d4f1ac804df39c0c708ca4624fb8
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Dec 7 11:39:43 2017 -0600
Embrace the Elixir
Turns out this idiom has a builtin reduce variant.
---
elixir_suite/test/uuids_test.exs | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/elixir_suite/test/uuids_test.exs b/elixir_suite/test/uuids_test.exs
index 563f73b..3eda458 100644
--- a/elixir_suite/test/uuids_test.exs
+++ b/elixir_suite/test/uuids_test.exs
@@ -50,10 +50,7 @@ defmodule UUIDsTest do
test "sequential uuids are sequential" do
resp = Couch.get("/_uuids", query: %{:count => 1000})
assert resp.status_code == 200
- [uuid | rest_uuids] = resp.body["uuids"]
-
- assert String.length(uuid) == 32
- Enum.reduce(rest_uuids, uuid, fn curr, acc ->
+ Enum.reduce(resp.body["uuids"], fn curr, acc ->
assert String.length(curr) == 32
assert acc < curr
curr
@@ -87,9 +84,7 @@ defmodule UUIDsTest do
test "utc_id uuids are correct" do
resp = Couch.get("/_uuids", query: %{:count => 10})
assert resp.status_code == 200
- [uuid | rest_uuids] = resp.body["uuids"]
-
- Enum.reduce(rest_uuids, uuid, fn curr, acc ->
+ Enum.reduce(resp.body["uuids"], fn curr, acc ->
assert String.length(curr) == 14 + String.length(@utc_id_suffix)
assert String.slice(curr, 14..-1) == @utc_id_suffix
assert curr > acc