Mercurial > python-hglib
comparison tests/test-grep.py @ 211:1a318162f06f
grep: update tests to cope with behavior change in hg 5.2
I wonder if we should make hglib's grep behave consistently across all
hg versions somehow, but I'm not going to attempt that for now.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Wed, 11 Dec 2019 10:20:58 -0500 |
parents | c1b966866ed7 |
children | 388820908580 |
comparison
equal
deleted
inserted
replaced
210:513ebe91dc72 | 211:1a318162f06f |
---|---|
8 self.client.commit(b('first'), addremove=True) | 8 self.client.commit(b('first'), addremove=True) |
9 | 9 |
10 # no match | 10 # no match |
11 self.assertEquals(list(self.client.grep(b('c'))), []) | 11 self.assertEquals(list(self.client.grep(b('c'))), []) |
12 | 12 |
13 self.assertEquals(list(self.client.grep(b('a'))), | 13 if self.client.version >= (5, 2): |
14 [(b('a'), b('0'), b('a')), (b('b'), b('0'), b('ab'))]) | 14 self.assertEquals(list(self.client.grep(b('a'))), |
15 self.assertEquals(list(self.client.grep(b('a'), b('a'))), | 15 [(b('a'), b('a'), b('b'))]) |
16 [(b('a'), b('0'), b('a'))]) | 16 self.assertEquals(list(self.client.grep(b('a'), b('a'))), |
17 [(b('a'), b('a'), b(''))]) | |
17 | 18 |
18 self.assertEquals(list(self.client.grep(b('b'))), | 19 self.assertEquals(list(self.client.grep(b('b'))), |
19 [(b('b'), b('0'), b('ab'))]) | 20 [(b('b'), b('ab'), b(''))]) |
21 else: | |
22 self.assertEquals(list(self.client.grep(b('a'))), | |
23 [(b('a'), b('0'), b('a')), (b('b'), b('0'), b('ab'))]) | |
24 self.assertEquals(list(self.client.grep(b('a'), b('a'))), | |
25 [(b('a'), b('0'), b('a'))]) | |
26 | |
27 self.assertEquals(list(self.client.grep(b('b'))), | |
28 [(b('b'), b('0'), b('ab'))]) | |
20 | 29 |
21 def test_options(self): | 30 def test_options(self): |
22 self.append('a', 'a\n') | 31 self.append('a', 'a\n') |
23 self.append('b', 'ab\n') | 32 self.append('b', 'ab\n') |
24 rev, node = self.client.commit(b('first'), addremove=True) | 33 rev, node = self.client.commit(b('first'), addremove=True) |
25 | 34 |
26 self.assertEquals([(b('a'), b('0'), b('+'), b('a')), | 35 self.assertEquals([(b('a'), b('0'), b('+'), b('a')), |
27 (b('b'), b('0'), b('+'), b('ab'))], | 36 (b('b'), b('0'), b('+'), b('ab'))], |
28 list(self.client.grep(b('a'), all=True))) | 37 list(self.client.grep(b('a'), all=True))) |
29 | 38 |
30 self.assertEquals([(b('a'), b('0')), (b('b'), b('0'))], | 39 if self.client.version >= (5, 2): |
31 list(self.client.grep(b('a'), fileswithmatches=True))) | 40 self.assertEquals([(b('a'), b('b'))], |
41 list(self.client.grep(b('a'), fileswithmatches=True))) | |
32 | 42 |
33 self.assertEquals([(b('a'), b('0'), b('1'), b('a')), | 43 self.assertEquals([(b('a'), b('1'), b('a'), b('b'))], |
34 (b('b'), b('0'), b('1'), b('ab'))], | 44 list(self.client.grep(b('a'), line=True))) |
35 list(self.client.grep(b('a'), line=True))) | |
36 | 45 |
37 self.assertEquals([(b('a'), b('0'), b('test'), b('a')), | 46 self.assertEquals([(b('a'), b('test'), b('a'), b('b'))], |
38 (b('b'), b('0'), b('test'), b('ab'))], | 47 list(self.client.grep(b('a'), user=True))) |
39 list(self.client.grep(b('a'), user=True))) | 48 else: |
49 self.assertEquals([(b('a'), b('0')), (b('b'), b('0'))], | |
50 list(self.client.grep(b('a'), fileswithmatches=True))) | |
51 | |
52 self.assertEquals([(b('a'), b('0'), b('1'), b('a')), | |
53 (b('b'), b('0'), b('1'), b('ab'))], | |
54 list(self.client.grep(b('a'), line=True))) | |
55 | |
56 self.assertEquals([(b('a'), b('0'), b('test'), b('a')), | |
57 (b('b'), b('0'), b('test'), b('ab'))], | |
58 list(self.client.grep(b('a'), user=True))) | |
40 | 59 |
41 self.assertEquals([(b('a'), b('0'), b('1'), b('+'), b('test')), | 60 self.assertEquals([(b('a'), b('0'), b('1'), b('+'), b('test')), |
42 (b('b'), b('0'), b('1'), b('+'), b('test'))], | 61 (b('b'), b('0'), b('1'), b('+'), b('test'))], |
43 list(self.client.grep(b('a'), all=True, user=True, | 62 list(self.client.grep(b('a'), all=True, user=True, |
44 line=True, | 63 line=True, |