annotate tests/test-grep.py @ 82:5484cfdc2d59

setup: build MANIFEST.in from hg manifest
author Matt Mackall <mpm@selenic.com>
date Thu, 10 Nov 2011 17:08:24 -0600
parents 9bd819da245a
children 1b47146a4a2c
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')],
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
37 list(self.client.grep('a', all=True, user=True, line=True,
9bd819da245a client: add grep command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
38 fileswithmatches=True)))