b2evolution PHP Cross Reference Blogging Systems

Source: /inc/_ext/phpsvnclient/ext/Diff/tests/pear_bug4879.phpt - 30 lines - 683 bytes - Text - Print

   1  --TEST--
   2  Text_Diff: PEAR Bug #4879 (inline renderer hangs on numbers in input string)
   3  --FILE--
   4  <?php
   5  include_once 'Text/Diff.php';
   6  include_once 'Text/Diff/Renderer/inline.php';
   7  
   8  $oldtext = <<<EOT
   9  Common text
  10  Bob had 1 apple, Alice had 2.
  11  Bon appetit!
  12  EOT;
  13  
  14  $newtext = <<< EOT
  15  Common text
  16  Bob had 10 apples, Alice had 1.
  17  Bon appetit!
  18  EOT;
  19  
  20  $oldpieces = explode ("\n", $oldtext);
  21  $newpieces = explode ("\n", $newtext);
  22  $diff = new Text_Diff('native', array($oldpieces, $newpieces));
  23  
  24  $renderer = new Text_Diff_Renderer_inline();
  25  echo $renderer->render($diff);
  26  ?>
  27  --EXPECT--
  28  Common text
  29  Bob had <del>1 apple,</del><ins>10 apples,</ins> Alice had <del>2.</del><ins>1.</ins>
  30  Bon appetit!

title

Description

title

Description

title

Description

title

title

Body