jiahuili430 commented on code in PR #5397:
URL: https://github.com/apache/couchdb/pull/5397#discussion_r1913599934


##########
test/elixir/test/uuids_test.exs:
##########
@@ -88,7 +88,7 @@ defmodule UUIDsTest do
 
     Enum.reduce(resp.body["uuids"], fn curr, acc ->
       assert String.length(curr) == 14 + String.length(@utc_id_suffix)
-      assert String.slice(curr, 14..-1//-1) == @utc_id_suffix
+      assert String.slice(curr, 14..-1//1) == @utc_id_suffix

Review Comment:
   - `-14..-1` doesn't work:
   ```bash
   $ make elixir tests=test/elixir/test/uuids_test.exs
     * test utc_id uuids are correct (9.4ms) [L#85]
    1) test utc_id uuids are correct (UUIDsTest)
        test/elixir/test/uuids_test.exs:85
        Assertion with == failed
        code:  assert String.slice(curr, -14..-1) == @utc_id_suffix
        left:  "9a44beed58frog"
        right: "frog"
        stacktrace:
          test/elixir/test/uuids_test.exs:91: anonymous fn/2 in UUIDsTest."test 
utc_id uuids are correct"/1
          (elixir 1.18.1) lib/enum.ex:2546: Enum."-reduce/2-lists^foldl/2-1-"/3
          test/elixir/test/uuids_test.exs:89: (test)
   ```
   
   - `14..-1` get following warnings:
   ```
   warning: 14..-1 has a default step of -1, please write 14..-1//-1 instead
     test/elixir/test/uuids_test.exs:91: UUIDsTest."test utc_id uuids are 
correct"/1
   ...
   warning: negative steps are not supported in String.slice/2, pass 14..-1//1 
instead
     (elixir 1.18.1) lib/string.ex:2418: String.slice/2
     test/elixir/test/uuids_test.exs:91: anonymous fn/2 in UUIDsTest."test 
utc_id uuids are correct"/1
     (elixir 1.18.1) lib/enum.ex:2546: Enum."-reduce/2-lists^foldl/2-1-"/3
     test/elixir/test/uuids_test.exs:89: UUIDsTest."test utc_id uuids are 
correct"/1
     (ex_unit 1.18.1) lib/ex_unit/runner.ex:511: ExUnit.Runner.exec_test/2
     (stdlib 6.2) timer.erl:595: :timer.tc/2
     (ex_unit 1.18.1) lib/ex_unit/runner.ex:433: anonymous fn/6 in 
ExUnit.Runner.spawn_test_monitor/4
   ```
   
   - `14..-1//1` no warnings.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to