~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Wouter van Heyst
  • Date: 2006-11-16 18:17:59 UTC
  • mto: This revision was merged to the branch mainline in revision 2139.
  • Revision ID: larstiq@larstiq.dyndns.org-20061116181759-pu74jhf3rackvjdn
Robuster external diff output handling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
 
113
113
    def test_external_diff_binary_lang_c(self):
114
114
        orig_lang = os.environ.get('LANG')
 
115
        orig_lc_all = os.environ.get('LC_ALL')
115
116
        try:
116
117
            os.environ['LANG'] = 'C'
 
118
            os.environ['LC_ALL'] = 'C'
117
119
            lines = external_udiff_lines(['\x00foobar\n'], ['foo\x00bar\n'])
118
120
            # Older versions of diffutils say "Binary files", newer
119
121
            # versions just say "Files".
121
123
                                  '(Binary f|F)iles old and new differ\n')
122
124
            self.assertEquals(lines[1:], ['\n'])
123
125
        finally:
124
 
            if orig_lang is None:
125
 
                del os.environ['LANG']
126
 
            else:
127
 
                os.environ['LANG'] = orig_lang
 
126
            for name, value in [('LANG', orig_lang), ('LC_ALL', orig_lc_all)]:
 
127
                if value is None:
 
128
                    del os.environ[name]
 
129
                else:
 
130
                    os.environ[name] = value
128
131
 
129
132
    def test_no_external_diff(self):
130
133
        """Check that NoDiff is raised when diff is not available"""