/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Aaron Bentley
  • Date: 2006-11-17 04:06:03 UTC
  • mfrom: (2139 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2162.
  • Revision ID: aaron.bentley@utoronto.ca-20061117040603-pgebxndswvwk26tt
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Development Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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"""