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 2010/03/26 13:06:07 UTC

svn commit: r927785 - /subversion/trunk/subversion/tests/libsvn_client/client-test.c

Author: rhuijben
Date: Fri Mar 26 12:06:07 2010
New Revision: 927785

URL: http://svn.apache.org/viewvc?rev=927785&view=rev
Log:
Apply some common sense to the patch test code. This doesn't fix the test on
Windows yet as the file that is compared has a unix eol on Windows.

* subversion/tests/libsvn_client/client-test.c
  (check_patch_result):
     Assume that our own apis return paths encoded as utf-8 (as we do
     everywhere) So don't try to translate the path to utf-8 again..
     and certainly not with the stream encoding, instead of the path
     encoding. This also allows us to use Subversion apis directly.
     Return more details in an error message from comparing the file.

Modified:
    subversion/trunk/subversion/tests/libsvn_client/client-test.c

Modified: subversion/trunk/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/client-test.c?rev=927785&r1=927784&r2=927785&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/client-test.c Fri Mar 26 12:06:07 2010
@@ -212,18 +212,11 @@ static svn_error_t *
 check_patch_result(const char *path, const char **expected_lines,
                    int num_expected_lines, apr_pool_t *pool)
 {
-  svn_string_t *path_svnstr;
-  svn_string_t *path_utf8;
-  apr_file_t *patched_file;
   svn_stream_t *stream;
   apr_pool_t *iterpool;
   int i;
 
-  path_svnstr = svn_string_create(path, pool);
-  SVN_ERR(svn_subst_translate_string(&path_utf8, path_svnstr, NULL, pool));
-  SVN_ERR(svn_io_file_open(&patched_file, path_utf8->data,
-                           APR_READ, APR_OS_DEFAULT, pool));
-  stream = svn_stream_from_aprfile2(patched_file, TRUE, pool);
+  SVN_ERR(svn_stream_open_readonly(&stream, path, pool, pool));
   i = 0;
   iterpool = svn_pool_create(pool);
   while (TRUE)
@@ -235,15 +228,20 @@ check_patch_result(const char *path, con
 
       SVN_ERR(svn_stream_readline(stream, &line, APR_EOL_STR, &eof, pool));
       if (i < num_expected_lines)
-        SVN_ERR_ASSERT(strcmp(expected_lines[i++], line->data) == 0);
+        if (strcmp(expected_lines[i++], line->data) != 0)
+          return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+                                   "%s line %d didn't match the expected line "
+                                   "(strlen=%d vs strlen=%d)", path, i,
+                                   strlen(expected_lines[i-1]),
+                                   strlen(line->data));
+
       if (eof)
         break;
     }
   svn_pool_destroy(iterpool);
 
-  SVN_ERR(svn_io_file_close(patched_file, pool));
   SVN_ERR_ASSERT(i == num_expected_lines);
-  SVN_ERR(svn_io_remove_file2(path_utf8->data, FALSE, pool));
+  SVN_ERR(svn_io_remove_file2(path, FALSE, pool));
 
   return SVN_NO_ERROR;
 }