annotate tests/test-grep.py @ 134:1b47146a4a2c 1.4

style: fix long lines
author Matt Mackall <mpm@selenic.com>
date Tue, 30 Sep 2014 12:48:04 -0500
parents 9bd819da245a
children 4359cabcb0cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
1 import common
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3 class test_grep(common.basetest):
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 def test_basic(self):
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 self.append('a', 'a\n')
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 self.append('b', 'ab\n')
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 self.client.commit('first', addremove=True)
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
8
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 # no match
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10 self.assertEquals(list(self.client.grep('c')), [])
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12 self.assertEquals(list(self.client.grep('a')),
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13 [('a', '0', 'a'), ('b', '0', 'ab')])
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 self.assertEquals(list(self.client.grep('a', 'a')), [('a', '0', 'a')])
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16 self.assertEquals(list(self.client.grep('b')), [('b', '0', 'ab')])
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18 def test_options(self):
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19 self.append('a', 'a\n')
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
20 self.append('b', 'ab\n')
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
21 rev, node = self.client.commit('first', addremove=True)
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
23 self.assertEquals([('a', '0', '+', 'a'), ('b', '0', '+', 'ab')],
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
24 list(self.client.grep('a', all=True)))
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
25
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
26 self.assertEquals([('a', '0'), ('b', '0')],
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
27 list(self.client.grep('a', fileswithmatches=True)))
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
28
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
29 self.assertEquals([('a', '0', '1', 'a'), ('b', '0', '1', 'ab')],
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
30 list(self.client.grep('a', line=True)))
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
31
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
32 self.assertEquals([('a', '0', 'test', 'a'), ('b', '0', 'test', 'ab')],
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
33 list(self.client.grep('a', user=True)))
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
34
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
35 self.assertEquals([('a', '0', '1', '+', 'test'),
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
36 ('b', '0', '1', '+', 'test')],
134
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 56
diff changeset
37 list(self.client.grep('a', all=True, user=True,
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 56
diff changeset
38 line=True,
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
39 fileswithmatches=True)))