diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2017-12-07 11:39:43 -0600 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2017-12-07 11:39:43 -0600 |
commit | 7b8e6c12d5f6da2bd787b84700504a3a82431b56 (patch) | |
tree | c731860537487a0b59b486dff683443e5083e9bb | |
parent | 67f6faef462e1b1327596dc2228c28c3deeaba0c (diff) | |
download | couchdb-7b8e6c12d5f6da2bd787b84700504a3a82431b56.tar.gz |
Embrace the Elixir
Turns out this idiom has a builtin reduce variant.
-rw-r--r-- | elixir_suite/test/uuids_test.exs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/elixir_suite/test/uuids_test.exs b/elixir_suite/test/uuids_test.exs index 563f73be3..3eda45824 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 |