tests/test-match.py
branchstable
changeset 43375 c2c3ee8794dd
parent 43076 2372284d9457
child 43949 8b1a9ba375e5
equal deleted inserted replaced
43374:65c37b431e76 43375:c2c3ee8794dd
   314         self.assertEqual(dm.visitchildrenset(b'dir/subdir/z'), b'this')
   314         self.assertEqual(dm.visitchildrenset(b'dir/subdir/z'), b'this')
   315         self.assertEqual(dm.visitchildrenset(b'dir/subdir/x'), b'this')
   315         self.assertEqual(dm.visitchildrenset(b'dir/subdir/x'), b'this')
   316 
   316 
   317     # We're using includematcher instead of patterns because it behaves slightly
   317     # We're using includematcher instead of patterns because it behaves slightly
   318     # better (giving narrower results) than patternmatcher.
   318     # better (giving narrower results) than patternmatcher.
   319     def testVisitdirIncludeIncludfe(self):
   319     def testVisitdirIncludeInclude(self):
   320         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
   320         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
   321         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
   321         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
   322         dm = matchmod.differencematcher(m1, m2)
   322         dm = matchmod.differencematcher(m1, m2)
   323         self.assertEqual(dm.visitdir(b''), True)
   323         self.assertEqual(dm.visitdir(b''), True)
   324         self.assertEqual(dm.visitdir(b'dir'), True)
   324         self.assertEqual(dm.visitdir(b'dir'), True)
   428         self.assertEqual(im.visitchildrenset(b'dir/subdir/z'), b'this')
   428         self.assertEqual(im.visitchildrenset(b'dir/subdir/z'), b'this')
   429         self.assertEqual(im.visitchildrenset(b'dir/subdir/x'), b'this')
   429         self.assertEqual(im.visitchildrenset(b'dir/subdir/x'), b'this')
   430 
   430 
   431     # We're using includematcher instead of patterns because it behaves slightly
   431     # We're using includematcher instead of patterns because it behaves slightly
   432     # better (giving narrower results) than patternmatcher.
   432     # better (giving narrower results) than patternmatcher.
   433     def testVisitdirIncludeIncludfe(self):
   433     def testVisitdirIncludeInclude(self):
   434         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
   434         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
   435         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
   435         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
   436         im = matchmod.intersectmatchers(m1, m2)
   436         im = matchmod.intersectmatchers(m1, m2)
   437         self.assertEqual(im.visitdir(b''), True)
   437         self.assertEqual(im.visitdir(b''), True)
   438         self.assertEqual(im.visitdir(b'dir'), True)
   438         self.assertEqual(im.visitdir(b'dir'), True)
   642         self.assertEqual(um.visitchildrenset(b'dir/subdir/z'), b'all')
   642         self.assertEqual(um.visitchildrenset(b'dir/subdir/z'), b'all')
   643         self.assertEqual(um.visitchildrenset(b'dir/subdir/x'), b'all')
   643         self.assertEqual(um.visitchildrenset(b'dir/subdir/x'), b'all')
   644 
   644 
   645     # We're using includematcher instead of patterns because it behaves slightly
   645     # We're using includematcher instead of patterns because it behaves slightly
   646     # better (giving narrower results) than patternmatcher.
   646     # better (giving narrower results) than patternmatcher.
   647     def testVisitdirIncludeIncludfe(self):
   647     def testVisitdirIncludeInclude(self):
   648         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
   648         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
   649         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
   649         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
   650         um = matchmod.unionmatcher([m1, m2])
   650         um = matchmod.unionmatcher([m1, m2])
   651         self.assertEqual(um.visitdir(b''), True)
   651         self.assertEqual(um.visitdir(b''), True)
   652         self.assertEqual(um.visitdir(b'dir'), True)
   652         self.assertEqual(um.visitdir(b'dir'), True)