annotate tests/test-grep.py @ 214:f422a5fdda79

Added tag 2.6.2 for changeset 388820908580
author Augie Fackler <raf@durin42.com>
date Tue, 17 Nov 2020 13:35:10 -0500
parents 388820908580
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
148
c1b966866ed7 hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents: 143
diff changeset
1 from tests import common
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
2 from hglib.util import b
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 class test_grep(common.basetest):
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 def test_basic(self):
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
6 self.append('a', 'x\n')
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
7 self.append('b', 'xy\n')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
8 self.client.commit(b('first'), addremove=True)
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10 # no match
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
11 self.assertEquals(list(self.client.grep(b('c'))), [])
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12
211
1a318162f06f grep: update tests to cope with behavior change in hg 5.2
Augie Fackler <raf@durin42.com>
parents: 148
diff changeset
13 if self.client.version >= (5, 2):
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
14 self.assertEquals(list(self.client.grep(b('x'))),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
15 [(b('a'), b('x')), (b('b'), b('xy'))])
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
16 self.assertEquals(list(self.client.grep(b('x'), b('a'))),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
17 [(b('a'), b('x'))])
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
19 self.assertEquals(list(self.client.grep(b('y'))),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
20 [(b('b'), b('xy'))])
211
1a318162f06f grep: update tests to cope with behavior change in hg 5.2
Augie Fackler <raf@durin42.com>
parents: 148
diff changeset
21 else:
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
22 self.assertEquals(list(self.client.grep(b('x'))),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
23 [(b('a'), b('0'), b('x')), (b('b'), b('0'), b('xy'))])
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
24 self.assertEquals(list(self.client.grep(b('x'), b('a'))),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
25 [(b('a'), b('0'), b('x'))])
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
26 self.assertEquals(list(self.client.grep(b('y'))),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
27 [(b('b'), b('0'), b('xy'))])
56
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 def test_options(self):
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
30 self.append('a', 'x\n')
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
31 self.append('b', 'xy\n')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
32 rev, node = self.client.commit(b('first'), addremove=True)
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
33
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
34 self.assertEquals([(b('a'), b('0'), b('+'), b('x')),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
35 (b('b'), b('0'), b('+'), b('xy'))],
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
36 list(self.client.grep(b('x'), all=True)))
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
37
211
1a318162f06f grep: update tests to cope with behavior change in hg 5.2
Augie Fackler <raf@durin42.com>
parents: 148
diff changeset
38 if self.client.version >= (5, 2):
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
39 self.assertEquals([(b('a'),), (b('b'),)],
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
40 list(self.client.grep(b('x'), fileswithmatches=True)))
211
1a318162f06f grep: update tests to cope with behavior change in hg 5.2
Augie Fackler <raf@durin42.com>
parents: 148
diff changeset
41
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
42 self.assertEquals([(b('a'), b('1'), b('x')), (b('b'), b('1'), b('xy'))],
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
43 list(self.client.grep(b('x'), line=True)))
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
44
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
45 self.assertEquals([(b('a'), b('test'), b('x')),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
46 (b('b'), b('test'), b('xy'))],
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
47 list(self.client.grep(b('x'), user=True)))
211
1a318162f06f grep: update tests to cope with behavior change in hg 5.2
Augie Fackler <raf@durin42.com>
parents: 148
diff changeset
48 else:
1a318162f06f grep: update tests to cope with behavior change in hg 5.2
Augie Fackler <raf@durin42.com>
parents: 148
diff changeset
49 self.assertEquals([(b('a'), b('0')), (b('b'), b('0'))],
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
50 list(self.client.grep(b('x'), fileswithmatches=True)))
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
51
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
52 self.assertEquals([(b('a'), b('0'), b('1'), b('x')),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
53 (b('b'), b('0'), b('1'), b('xy'))],
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
54 list(self.client.grep(b('x'), line=True)))
211
1a318162f06f grep: update tests to cope with behavior change in hg 5.2
Augie Fackler <raf@durin42.com>
parents: 148
diff changeset
55
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
56 self.assertEquals([(b('a'), b('0'), b('test'), b('x')),
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
57 (b('b'), b('0'), b('test'), b('xy'))],
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
58 list(self.client.grep(b('x'), user=True)))
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
59
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
60 self.assertEquals([(b('a'), b('0'), b('1'), b('+'), b('test')),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
61 (b('b'), b('0'), b('1'), b('+'), b('test'))],
213
388820908580 hglib: update grep to cope with behavior change in hg 5.2.
Daehyeok Mun <daehyeok@gmail.com>
parents: 211
diff changeset
62 list(self.client.grep(b('x'), all=True, user=True,
134
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 56
diff changeset
63 line=True,
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
64 fileswithmatches=True)))