~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Vincent Ladeuil
  • Date: 2011-08-21 15:14:57 UTC
  • mfrom: (6015.9.16 2.4)
  • mto: This revision was merged to the branch mainline in revision 6091.
  • Revision ID: v.ladeuil+lp@free.fr-20110821151457-bppnur2h290un2nt
Merge 2.4 into trunk (including fix for bug #829237)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2857
2857
    def get_store(self, file_name):
2858
2858
        return config.IniFileStore(self.get_readonly_transport(), file_name)
2859
2859
 
 
2860
    def test_unrelated_section_excluded(self):
 
2861
        store = self.get_store('foo.conf')
 
2862
        store._load_from_string('''
 
2863
[/foo]
 
2864
section=/foo
 
2865
[/foo/baz]
 
2866
section=/foo/baz
 
2867
[/foo/bar]
 
2868
section=/foo/bar
 
2869
[/foo/bar/baz]
 
2870
section=/foo/bar/baz
 
2871
[/quux/quux]
 
2872
section=/quux/quux
 
2873
''')
 
2874
        self.assertEquals(['/foo', '/foo/baz', '/foo/bar', '/foo/bar/baz',
 
2875
                           '/quux/quux'],
 
2876
                          [section.id for section in store.get_sections()])
 
2877
        matcher = config.LocationMatcher(store, '/foo/bar/quux')
 
2878
        sections = list(matcher.get_sections())
 
2879
        self.assertEquals([3, 2],
 
2880
                          [section.length for section in sections])
 
2881
        self.assertEquals(['/foo/bar', '/foo'],
 
2882
                          [section.id for section in sections])
 
2883
        self.assertEquals(['quux', 'bar/quux'],
 
2884
                          [section.extra_path for section in sections])
 
2885
 
2860
2886
    def test_more_specific_sections_first(self):
2861
2887
        store = self.get_store('foo.conf')
2862
2888
        store._load_from_string('''