612
612
'--- old label\n+++ new label\n@@ -1,1 +1,1 @@\n-old\n+new\n\n',
613
613
differ.to_file.getvalue())
615
def test_diff_deletion(self):
616
self.build_tree_contents([('old-tree/file', 'contents'),
617
('new-tree/file', 'contents')])
618
self.old_tree.add('file', 'file-id')
619
self.new_tree.add('file', 'file-id')
620
os.unlink('new-tree/file')
621
self.differ.show_diff(None)
622
self.assertContainsRe(self.differ.to_file.getvalue(), '-contents')
624
def test_diff_creation(self):
625
self.build_tree_contents([('old-tree/file', 'contents'),
626
('new-tree/file', 'contents')])
627
self.old_tree.add('file', 'file-id')
628
self.new_tree.add('file', 'file-id')
629
os.unlink('old-tree/file')
630
self.differ.show_diff(None)
631
self.assertContainsRe(self.differ.to_file.getvalue(), '\+contents')
615
633
def test_diff_symlink(self):
616
634
differ = DiffSymlink(self.old_tree, self.new_tree, StringIO())
617
635
differ.diff_symlink('old target', None)