/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 breezy/plugins/grep/test_grep.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-03-25 11:54:30 UTC
  • mfrom: (6855.4.10 more-bees)
  • Revision ID: breezy.the.bot@gmail.com-20180325115430-75xnlbrmzjoomd83
Add more bees. In particular:

* for file ids
* for revision ids
* for file contents in build_tree_contents()

Merged from https://code.launchpad.net/~jelmer/brz/more-bees/+merge/337919

Show diffs side-by-side

added added

removed removed

Lines of Context:
2155
2155
    def make_example_branch(self):
2156
2156
        tree = self.make_branch_and_tree('.')
2157
2157
        self.build_tree_contents([
2158
 
            ('hello', 'foo\n'),
2159
 
            ('goodbye', 'baz\n')])
 
2158
            ('hello', b'foo\n'),
 
2159
            ('goodbye', b'baz\n')])
2160
2160
        tree.add(['hello'])
2161
2161
        tree.commit('setup')
2162
2162
        tree.add(['goodbye'])
2166
2166
    def test_grep_diff_basic(self):
2167
2167
        """grep -p basic test."""
2168
2168
        tree = self.make_example_branch()
2169
 
        self.build_tree_contents([('hello', 'hello world!\n')])
 
2169
        self.build_tree_contents([('hello', b'hello world!\n')])
2170
2170
        tree.commit('updated hello')
2171
2171
        out, err = self.run_bzr(['grep', '-p', 'hello'])
2172
2172
        self.assertEqual(err, '')
2185
2185
    def test_grep_diff_revision(self):
2186
2186
        """grep -p specific revision."""
2187
2187
        tree = self.make_example_branch()
2188
 
        self.build_tree_contents([('hello', 'hello world!\n')])
 
2188
        self.build_tree_contents([('hello', b'hello world!\n')])
2189
2189
        tree.commit('updated hello')
2190
2190
        out, err = self.run_bzr(['grep', '-p', '-r', '3', 'hello'])
2191
2191
        self.assertEqual(err, '')
2200
2200
    def test_grep_diff_revision_range(self):
2201
2201
        """grep -p revision range."""
2202
2202
        tree = self.make_example_branch()
2203
 
        self.build_tree_contents([('hello', 'hello world!1\n')]) # rev 3
 
2203
        self.build_tree_contents([('hello', b'hello world!1\n')]) # rev 3
2204
2204
        tree.commit('rev3')
2205
 
        self.build_tree_contents([('blah', 'hello world!2\n')]) # rev 4
 
2205
        self.build_tree_contents([('blah', b'hello world!2\n')]) # rev 4
2206
2206
        tree.add('blah')
2207
2207
        tree.commit('rev4')
2208
2208
        open('hello', 'a').write('hello world!3\n')
2229
2229
    def test_grep_diff_color(self):
2230
2230
        """grep -p color test."""
2231
2231
        tree = self.make_example_branch()
2232
 
        self.build_tree_contents([('hello', 'hello world!\n')])
 
2232
        self.build_tree_contents([('hello', b'hello world!\n')])
2233
2233
        tree.commit('updated hello')
2234
2234
        out, err = self.run_bzr(['grep', '--diff', '-r', '3',
2235
2235
            '--color', 'always', 'hello'])