You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2011/02/09 04:27:17 UTC

svn commit: r1068749 - /subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c

Author: danielsh
Date: Wed Feb  9 03:27:16 2011
New Revision: 1068749

URL: http://svn.apache.org/viewvc?rev=1068749&view=rev
Log:
Add a diff4 test.

Review by: jcorvel

* subversion/tests/libsvn_diff/diff-diff3-test.c
  (test_diff4, test_list):
    New test, hard-coded from notes/variance-adjusted-patching.html.

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

Modified: subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c?rev=1068749&r1=1068748&r2=1068749&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c Wed Feb  9 03:27:16 2011
@@ -2050,6 +2050,39 @@ test_three_way_merge_conflict_styles(apr
 
 
 static svn_error_t *
+test_diff4(apr_pool_t *pool)
+{
+  svn_diff_t *diff;
+  svn_stream_t *actual, *expected;
+  svn_boolean_t same;
+
+  /* Usage: tools/diff/diff4 <mine> <older> <yours> <ancestor> */
+  /* tools/diff/diff4 B2 T2 T3 T1 > B2new */
+  SVN_ERR(svn_diff_file_diff4(&diff, "T2", "B2", "T3", "T1", pool));
+
+  /* Sanity. */
+  SVN_TEST_ASSERT(! svn_diff_contains_conflicts(diff));
+  SVN_TEST_ASSERT(svn_diff_contains_diffs(diff));
+
+  /* Comparison. */
+  SVN_ERR(svn_stream_open_readonly(&expected, "B2new", pool, pool));
+  actual = svn_stream_from_stringbuf(
+             svn_stringbuf_create_ensure(417, pool), /* 417 == wc -c < B2new */
+             pool);
+  SVN_ERR(svn_diff_file_output_merge(actual, diff,
+                                     "T2", "B2", "T3",
+                                     NULL, NULL, NULL, NULL,
+                                     FALSE,
+                                     FALSE,
+                                     pool));
+  SVN_ERR(svn_stream_contents_same2(&same, actual, expected, pool));
+  SVN_TEST_ASSERT(same);
+
+  return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
 random_trivial_merge(apr_pool_t *pool)
 {
   int i;
@@ -2300,5 +2333,7 @@ struct svn_test_descriptor_t test_funcs[
                    "3-way merge, adjacent changes"),
     SVN_TEST_PASS2(test_three_way_merge_conflict_styles,
                    "3-way merge with conflict styles"),
+    SVN_TEST_PASS2(test_diff4,
+                   "4-way merge; see variance-adjusted-patching.html"),
     SVN_TEST_NULL
   };