b2evolution PHP Cross Reference Blogging Systems

Source: /inc/_ext/phpsvnclient/ext/Diff/tests/pear_bug6251.phpt - 45 lines - 705 bytes - Text - Print

   1  --TEST--
   2  Text_Diff: PEAR Bug #6251 (too much trailing context)
   3  --FILE--
   4  <?php
   5  include_once 'Text/Diff.php';
   6  include_once 'Text/Diff/Renderer/unified.php';
   7  
   8  $oldtext = <<<EOT
   9  
  10  Original Text
  11  
  12  
  13  
  14  ss
  15  ttt
  16  EOT;
  17  
  18  $newtext = <<< EOT
  19  
  20  Modified Text
  21  
  22  
  23  
  24  ss
  25  ttt
  26  EOT;
  27  
  28  $oldpieces = explode ("\n", $oldtext);
  29  $newpieces = explode ("\n", $newtext);
  30  $diff = new Text_Diff('native', array($oldpieces, $newpieces));
  31  
  32  $renderer = new Text_Diff_Renderer_unified(array('leading_context_lines' => 3, 'trailing_context_lines' => 3));
  33  
  34  // We need to use var_dump, as the test runner strips trailing empty lines.
  35  var_dump($renderer->render($diff));
  36  ?>
  37  --EXPECT--
  38  string(54) "@@ -1,5 +1,5 @@
  39   
  40  -Original Text
  41  +Modified Text
  42   
  43   
  44   
  45  "

title

Description

title

Description

title

Description

title

title

Body