MCPcopy Create free account
hub / github.com/etingof/apacheconfig / testHashComments

Method testHashComments

tests/unit/test_parser.py:65–91  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

63 self.assertEqual(ast, ['contents', ['statement', 'a', 'b']])
64
65 def testHashComments(self):
66 text = """\
67#a
68# b
69c c# c
70c \\# # c
71key value\\#123
72"""
73 ApacheConfigLexer = make_lexer()
74 ApacheConfigParser = make_parser()
75
76 parser = ApacheConfigParser(
77 ApacheConfigLexer(), start='contents')
78
79 ast = parser.parse(text)
80 self.assertEqual(
81 ast, [
82 'contents',
83 ['comment', '#a'],
84 ['comment', '# b'],
85 ['statement', 'c', 'c'],
86 ['comment', '# c'],
87 ['statement', 'c', '\\#'],
88 ['comment', '# c'],
89 ['statement', 'key', 'value\\#123']
90 ]
91 )
92
93 def testCStyleComments(self):
94 text = """\

Callers

nothing calls this directly

Calls 3

make_lexerFunction · 0.90
make_parserFunction · 0.90
parseMethod · 0.45

Tested by

no test coverage detected