~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Aaron Bentley
  • Date: 2007-12-06 18:20:35 UTC
  • mto: This revision was merged to the branch mainline in revision 3088.
  • Revision ID: abentley@panoramicfeedback.com-20071206182035-fsvtracks7b99c14
Diff handles missing files correctly, with no tracebacks

Show diffs side-by-side

added added

removed removed

Lines of Context:
612
612
            '--- old label\n+++ new label\n@@ -1,1 +1,1 @@\n-old\n+new\n\n',
613
613
            differ.to_file.getvalue())
614
614
 
 
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')
 
623
 
 
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')
 
632
 
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)