(self)
| 63 | self.assertEqual(ast, ['contents', ['statement', 'a', 'b']]) |
| 64 | |
| 65 | def testHashComments(self): |
| 66 | text = """\ |
| 67 | #a |
| 68 | # b |
| 69 | c c# c |
| 70 | c \\# # c |
| 71 | key 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 = """\ |
nothing calls this directly
no test coverage detected