sebastianbergmann / diff

Diff implementation
BSD 3-Clause "New" or "Revised" License
7.58k stars 85 forks source link

Show Diff line endings #63

Closed SpacePossum closed 7 years ago

SpacePossum commented 7 years ago

This PR:

The last one is the most important one, not only for the output. Sample code;

    $diff = new \SebastianBergmann\Diff\Differ();
    $diff = $diff->diff(
        "<?php\n",
        "<?php\r"
    );

Output on 1.4

--- Original
+++ New
@@ @@
 #Warning: Strings contain different line endings!
 <?php

Output proposed in PR;

--- Original
+++ New
@@ @@
 #Warning: Strings contain different line endings!
-<?php
"<?php

(note the location of the last " because of the \r being outputted as well) Having both a ADDED and REMOVED line is essential for creating valid diff, but already for readability in some other cases.

keradus commented 7 years ago

aaaah, almost started reviewing :D

codecov-io commented 7 years ago

Codecov Report

Merging #63 into master will increase coverage by 0.02%. The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #63      +/-   ##
============================================
+ Coverage     99.68%   99.71%   +0.02%     
- Complexity      121      138      +17     
============================================
  Files            10       10              
  Lines           315      347      +32     
============================================
+ Hits            314      346      +32     
  Misses            1        1
Impacted Files Coverage Δ Complexity Δ
src/Differ.php 99.09% <100%> (+0.21%) 48 <16> (+12) :arrow_up:
src/Output/UnifiedDiffOutputBuilder.php 100% <100%> (ø) 18 <0> (+3) :arrow_up:
src/Output/DiffOnlyOutputBuilder.php 100% <100%> (ø) 10 <0> (+2) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3c40ca4...832f508. Read the comment docs.