iilyak commented on code in PR #5603:
URL: https://github.com/apache/couchdb/pull/5603#discussion_r2307611098


##########
src/chttpd/test/eunit/chttpd_changes_test.erl:
##########
@@ -493,6 +495,97 @@ t_docs_id_filter_over_limit({_, DbUrl}) ->
         Rows
     ).
 
+t_time_since({_, DbUrl}) ->
+    % Far into the future, we should get nothing
+    Params1 = "?since=3000-02-03T04:05:00Z",
+    {Seq1, Pending1, Rows1} = changes(DbUrl, Params1),
+    ?assertEqual(8, Seq1),
+    ?assertEqual(0, Pending1),
+    ?assertEqual([], Rows1),
+
+    % Before the feature is released, should same as since=0
+    Params2 = "?since=2025-01-01T04:05:00Z",
+    Res2 = {Seq2, Pending2, Rows2} = changes(DbUrl, Params2),
+    ?assertEqual(8, Seq2),
+    ?assertEqual(0, Pending2),
+    ?assertEqual(
+        [
+            {6, {?DOC1, <<"2-c">>}, ?LEAFREV},
+            {7, {?DOC3, <<"2-b">>}, ?DELETED},
+            {8, {?DDOC2, <<"2-c">>}, ?LEAFREV}
+        ],
+        Rows2
+    ),
+    % Verify we're getting the same results as since=0
+    ?assertEqual(Res2, changes(DbUrl, "?since=0")),

Review Comment:
   Assertions in eunit [are 
implemented](https://github.com/erlang/otp/blob/master/lib/eunit/include/eunit.hrl#L87)
 by delegation to 
[`stdlib/include/assert.hrl`](https://github.com/erlang/otp/blob/master/lib/stdlib/include/assert.hrl).
 As a consequence of that each assertion variant has an optional `Comment` 
argument. So you can write a self documenting tests. No need for comments.
   
   ```erlang
   ?assertEqual(Res2, changes(DbUrl, "?since=0"),
       "Expected the same result as from '?since=0'"
   ),
   ```



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