Beispiel #1
0
class TestGlobalLexer(unittest.TestCase):
    def setUp(self):
        self.lexer = GlobalLexer()

    def testCanMatchFullPattern(self):
        actual = self.lexer.parse(r'/foo/p#')
        self.assertEqual(actual, ['foo', 'p#'])

    def testCanMatchEmtpySearch(self):
        actual = self.lexer.parse(r'//p#')
        self.assertEqual(actual, ['', 'p#'])

    def testCanEscapeCharactersInSearchPattern(self):
        actual = self.lexer.parse(r'/\/foo\//p#')
        self.assertEqual(actual, ['/foo/', 'p#'])

    def testCanEscapeBackSlashes(self):
        actual = self.lexer.parse(r'/\\/p#')
        self.assertEqual(actual, ['\\', 'p#'])
Beispiel #2
0
 def setUp(self):
     self.lexer = GlobalLexer()