Fixed issue 129, code review crashes on git diff files.

The diff parser tries now to skip the header and possible footer.
This commit is contained in:
Loic d'Anterroches
2009-02-02 20:55:45 +01:00
parent 269f1db816
commit d594b3412a
3 changed files with 74 additions and 1 deletions

View File

@@ -69,6 +69,14 @@ class IDF_Tests_TestDiff extends UnitTestCase
$lline = end($lchunk);
$this->assertEqual(array('', '166', '{/if}{/block}'),
$lline);
//print_r($diff->mergeChunks($orig_lines, $def, 10));
}
public function testDiffWithHeaders()
{
$diff_content = file_get_contents(dirname(__FILE__).'/0001-Some-configuration-variables-have-been-added-in-orde.patch');
$diff = new IDF_Diff($diff_content);
$diff->parse();
$this->assertEqual(2, count($diff->files));
$this->assertEqual(12, count($diff->files['src/IDF/conf/idf.php-dist']['chunks'][0]));
}
}