~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_rules.py

  • Committer: Ian Clatworthy
  • Date: 2008-05-15 14:39:19 UTC
  • mto: (3515.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3516.
  • Revision ID: ian.clatworthy@canonical.com-20080515143919-16pf8dgra3s6uab4
add tests for _StackedRulesSearcher

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
            rs.get_items('dir/a.txt'))
70
70
 
71
71
 
 
72
class TestStackedRulesSearcher(tests.TestCase):
 
73
 
 
74
    def make_searcher(self, lines1=None, lines2=None):
 
75
        """Make a _StackedRulesSearcher with 0, 1 or 2 items"""
 
76
        searchers = []
 
77
        if lines1 is not None:
 
78
            searchers.append(rules._IniBasedRulesSearcher(lines1))
 
79
        if lines2 is not None:
 
80
            searchers.append(rules._IniBasedRulesSearcher(lines2))
 
81
        return rules._StackedRulesSearcher(searchers)
 
82
 
 
83
    def test_stack_searching(self):
 
84
        rs = self.make_searcher(
 
85
            ["[./a.txt]", "foo=baz"],
 
86
            ["[*.txt]", "foo=bar", "a=True"])
 
87
        self.assertEquals((('foo', 'baz'),),
 
88
            rs.get_items('a.txt'))
 
89
        self.assertEquals((('foo', 'bar'), ('a', 'True')),
 
90
            rs.get_items('dir/a.txt'))
 
91
 
 
92
 
72
93
class TestRulesPath(tests.TestCase):
73
94
 
74
95
    def setUp(self):