~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/grep/test_grep.py

  • Committer: Jelmer Vernooij
  • Date: 2012-08-02 10:38:21 UTC
  • mto: This revision was merged to the branch mainline in revision 6555.
  • Revision ID: jelmer@samba.org-20120802103821-pto2dgacjtmpzl1n
Move color feature into bzrlib.tests.features.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import unicodedata as ud
22
22
 
23
23
from bzrlib import tests, osutils
24
 
from bzrlib._termcolor import color_string, FG
 
24
from bzrlib.termcolor import color_string, FG
25
25
 
26
26
from bzrlib.tests.features import (
27
27
    ColorFeature,
1446
1446
        self.assertContainsRe(out, "file1.txt~1.1.4:text 2", flags=TestGrep._reflags)
1447
1447
        self.assertEqual(len(out.splitlines()), 6)
1448
1448
 
 
1449
        out, err = self.run_bzr(['grep', '-r', '1.1.4..1.1.1', 'text'])
 
1450
        self.assertContainsRe(out, "file1.txt~1.1.2:text 0", flags=TestGrep._reflags)
 
1451
        self.assertContainsRe(out, "file1.txt~1.1.3:text 1", flags=TestGrep._reflags)
 
1452
        self.assertContainsRe(out, "file1.txt~1.1.3:text 1", flags=TestGrep._reflags)
 
1453
        self.assertContainsRe(out, "file1.txt~1.1.4:text 0", flags=TestGrep._reflags)
 
1454
        self.assertContainsRe(out, "file1.txt~1.1.4:text 1", flags=TestGrep._reflags)
 
1455
        self.assertContainsRe(out, "file1.txt~1.1.4:text 2", flags=TestGrep._reflags)
 
1456
        self.assertEqual(len(out.splitlines()), 6)
 
1457
 
 
1458
        out, err = self.run_bzr(['grep', '--levels=1', '-r', '1.1.1..1.1.4', 'text'])
 
1459
        self.assertContainsRe(out, "file1.txt~1.1.2:text 0", flags=TestGrep._reflags)
 
1460
        self.assertContainsRe(out, "file1.txt~1.1.3:text 1", flags=TestGrep._reflags)
 
1461
        self.assertContainsRe(out, "file1.txt~1.1.3:text 1", flags=TestGrep._reflags)
 
1462
        self.assertContainsRe(out, "file1.txt~1.1.4:text 0", flags=TestGrep._reflags)
 
1463
        self.assertContainsRe(out, "file1.txt~1.1.4:text 1", flags=TestGrep._reflags)
 
1464
        self.assertContainsRe(out, "file1.txt~1.1.4:text 2", flags=TestGrep._reflags)
 
1465
        self.assertEqual(len(out.splitlines()), 6)
 
1466
 
 
1467
        out, err = self.run_bzr(['grep', '-r', '1..1.1.4', 'text'])
 
1468
        self.assertContainsRe(out, "file1.txt~1.1.2:text 0", flags=TestGrep._reflags)
 
1469
        self.assertContainsRe(out, "file1.txt~1.1.3:text 1", flags=TestGrep._reflags)
 
1470
        self.assertContainsRe(out, "file1.txt~1.1.3:text 1", flags=TestGrep._reflags)
 
1471
        self.assertContainsRe(out, "file1.txt~1.1.4:text 0", flags=TestGrep._reflags)
 
1472
        self.assertContainsRe(out, "file1.txt~1.1.4:text 1", flags=TestGrep._reflags)
 
1473
        self.assertContainsRe(out, "file1.txt~1.1.4:text 2", flags=TestGrep._reflags)
 
1474
        self.assertEqual(len(out.splitlines()), 6)
 
1475
 
 
1476
 
1449
1477
    def test_versioned_binary_file_grep(self):
1450
1478
        """(versioned) Grep for pattern in binary file.
1451
1479
        """