~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-12-06 19:15:12 UTC
  • mfrom: (3087.1.1 Aaron's integration)
  • Revision ID: pqm@pqm.ubuntu.com-20071206191512-6tvqmou1db89q6oi
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)