@@ -28,5 +28,35 @@ def test_diff_with_rename(self):
2828 assert_equal (diff .rename_from , 'AUTHORS' )
2929 assert_equal (diff .rename_to , 'CONTRIBUTORS' )
3030
31+ def test_diff_patch_format (self ):
32+ # test all of the 'old' format diffs for completness - it should at least
33+ # be able to deal with it
34+ fixtures = ("diff_2" , "diff_2f" , "diff_f" , "diff_i" , "diff_mode_only" ,
35+ "diff_new_mode" , "diff_numstat" , "diff_p" , "diff_rename" ,
36+ "diff_tree_numstat_root" )
37+
38+ for fixture_name in fixtures :
39+ diff_proc = ListProcessAdapter (fixture (fixture_name ))
40+ diffs = Diff ._index_from_patch_format (self .repo , diff_proc .stdout )
41+ # END for each fixture
42+
3143 def test_diff_interface (self ):
44+ # test a few variations of the main diff routine
45+ for i , commit in enumerate (self .repo .iter_commits ('0.1.6' , max_count = 10 )):
46+ diff_item = commit
47+ if i % 2 == 0 :
48+ diff_item = commit .tree
49+ # END use tree every second item
50+
51+ for other in (None , commit .parents [0 ]):
52+ for paths in (None , "CHANGES" , ("CHANGES" , "lib" )):
53+ for create_patch in range (2 ):
54+ diff_index = diff_item .diff (other , paths , create_patch )
55+ assert diff_index
56+ # END for each patch option
57+ # END for each path option
58+ # END for each other side
59+ # END for each commit
60+
61+
3262 self .fail ( "TODO: Test full diff interface on commits, trees, index, patch and non-patch" )
0 commit comments