mirror of
https://github.com/facebook/sapling.git
synced 2025-01-06 21:48:36 +03:00
4dd04bf02f
Summary: The hgpython interpreter was used to run Python scripts in tests that might rely on Mercurial modules. The previous hgpython implementation is Python PAR based, which does not have access to native Rust modules like bindings. Change it to use the native "hg debugpython" implementation that is more compatible. Reviewed By: markbt Differential Revision: D19190496 fbshipit-source-id: 9791dbf9ba0ed92de702291faa9145f01b05ec40
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
from __future__ import absolute_import
|
|
|
|
import unittest
|
|
|
|
import silenttestrunner
|
|
from edenscm.mercurial import match as matchmod
|
|
|
|
|
|
class NeverMatcherTests(unittest.TestCase):
|
|
def testVisitdir(self):
|
|
m = matchmod.nevermatcher("", "")
|
|
self.assertFalse(m.visitdir(""))
|
|
self.assertFalse(m.visitdir("dir"))
|
|
|
|
def testManyGlobRaises(self):
|
|
n = 10000
|
|
rules = ["a/b/*/c/d/e/f/g/%s/**" % i for i in range(n)]
|
|
with self.assertRaises(Exception):
|
|
# "Compiled regex exceeds size limit of 10485760 bytes."
|
|
matchmod.treematcher("", "", rules=rules)
|
|
|
|
def testManyPrefixes(self):
|
|
n = 10000
|
|
rules = ["a/b/c/d/e/f/g/%s/**" % i for i in range(n)]
|
|
m = matchmod.treematcher("", "", rules=rules)
|
|
self.assertTrue(m.visitdir("a"))
|
|
self.assertTrue(m.visitdir("a/b"))
|
|
self.assertEqual(m.visitdir("a/b/c/d/e/f/g/1"), "all")
|
|
self.assertFalse(m.visitdir("b"))
|
|
self.assertTrue(m("a/b/c/d/e/f/g/99/x"))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
silenttestrunner.main(__name__)
|