Update xdiff to not display the ,1 if the length is 1 on unified mode. Add the unit tests

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4311 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2018-07-30 13:31:37 +00:00
parent ccee53e033
commit a5efc67431
2 changed files with 40 additions and 3 deletions

View File

@@ -285,7 +285,8 @@ class xdiff
$info .= ",0";
$info .= " +";
$info .= $diff["startLine2"];
$info .= ",".$diff["length"];
if ($diff["length"] !== 1)
$info .= ",".$diff["length"];
$info .= " @@\n";
$d .= $info;
$d .= "+".implode ("+", $diff["chunk"]);
@@ -294,7 +295,8 @@ class xdiff
{
$info = "@@ -";
$info .= $diff["startLine1"];
$info .= ",".$diff["length"];
if ($diff["length"] !== 1)
$info .= ",".$diff["length"];
$info .= " +";
$info .= $diff["startLine2"];
$info .= ",0";