annotate tests/test-grep.py @ 148:c1b966866ed7

hglib: make all imports absolute (issue4520)
author Brett Cannon <brett@python.org>
date Fri, 13 Mar 2015 14:46:13 -0400
parents 4359cabcb0cc
children 1a318162f06f
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):
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 self.append('a', 'a\n')
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 self.append('b', 'ab\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
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
13 self.assertEquals(list(self.client.grep(b('a'))),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
14 [(b('a'), b('0'), b('a')), (b('b'), b('0'), b('ab'))])
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
15 self.assertEquals(list(self.client.grep(b('a'), b('a'))),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
16 [(b('a'), b('0'), b('a'))])
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
18 self.assertEquals(list(self.client.grep(b('b'))),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
19 [(b('b'), b('0'), b('ab'))])
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
20
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
21 def test_options(self):
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22 self.append('a', 'a\n')
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
23 self.append('b', 'ab\n')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
24 rev, node = self.client.commit(b('first'), addremove=True)
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
25
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
26 self.assertEquals([(b('a'), b('0'), b('+'), b('a')),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
27 (b('b'), b('0'), b('+'), b('ab'))],
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
28 list(self.client.grep(b('a'), all=True)))
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
29
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
30 self.assertEquals([(b('a'), b('0')), (b('b'), b('0'))],
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
31 list(self.client.grep(b('a'), fileswithmatches=True)))
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
32
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
33 self.assertEquals([(b('a'), b('0'), b('1'), b('a')),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
34 (b('b'), b('0'), b('1'), b('ab'))],
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
35 list(self.client.grep(b('a'), line=True)))
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
36
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
37 self.assertEquals([(b('a'), b('0'), b('test'), b('a')),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
38 (b('b'), b('0'), b('test'), b('ab'))],
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
39 list(self.client.grep(b('a'), user=True)))
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
40
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
41 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
42 (b('b'), 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
43 list(self.client.grep(b('a'), all=True, user=True,
134
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 56
diff changeset
44 line=True,
56
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
45 fileswithmatches=True)))