You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/09/24 18:08:20 UTC

svn commit: r1705094 - /subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Author: rhuijben
Date: Thu Sep 24 16:08:20 2015
New Revision: 1705094

URL: http://svn.apache.org/viewvc?rev=1705094&view=rev
Log:
Following up on r1705038, r1705080, update expected result in the diff parse c
tests on missing EOLs.

A missing eol in the patch file shouldn't affect the actual hunk. Only a no
finale EOL marker should really create a no-final EOL result.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (stream_readline_diff): New function.
  (check_content): Use stream_readline_diff.

Modified:
    subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=1705094&r1=1705093&r2=1705094&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Thu Sep 24 16:08:20 2015
@@ -303,6 +303,24 @@ create_patch_file(svn_patch_file_t **pat
   return SVN_NO_ERROR;
 }
 
+/* svn_stream_readline() with hunk reader semantics */
+static svn_error_t *
+stream_readline_diff(svn_stream_t *stream,
+                     svn_stringbuf_t **buf,
+                     const char *eol,
+                     svn_boolean_t *eof,
+                     apr_pool_t *result_pool)
+{
+  SVN_ERR(svn_stream_readline(stream, buf, eol, eof, result_pool));
+
+  /* Hunks are only at EOF after they are completely read, even if
+     they don't have a final EOL in the text */
+  if (*eof && (*buf)->len)
+    *eof = FALSE;
+
+  return SVN_NO_ERROR;
+}
+
 /* Check that reading a line from HUNK equals what's inside EXPECTED.
  * If ORIGINAL is TRUE, read the original hunk text; else, read the
  * modified hunk text. */
@@ -321,7 +339,7 @@ check_content(svn_diff_hunk_t *hunk, svn
 
   while (TRUE)
   {
-    SVN_ERR(svn_stream_readline(exp, &exp_buf, NL, &exp_eof, pool));
+    SVN_ERR(stream_readline_diff(exp, &exp_buf, NL, &exp_eof, pool));
     if (original)
       SVN_ERR(svn_diff_hunk_readline_original_text(hunk, &hunk_buf, NULL,
                                                    &hunk_eof, pool, pool));