def test_compact(self): compact_tag = r"/*..class:: type*/" comments = CxxProcessor(self.project, self.module, InputBuffer("compact_tag", compact_tag)) stream = comments.process().stream() first = next_value(stream.read()) self.assertEqual(first, r"..class:: type")
def test_macro_cont(self): proc = CxxProcessor( self.project, self.module, InputBuffer(self.test_macro_cont.__name__, macro_cont_stmt), ) proc.process()
def test_macro(self): # Not technically part of C or a statement but important to parse # for meta extraction process proc = CxxProcessor( self.project, self.module, InputBuffer(self.test_macro.__name__, macro_stmt), ) proc.process()
def test_two_lines(self): two_lines = r"""//// blah // blah2 """ comments = CxxProcessor(self.project, self.module, InputBuffer("two_lines", two_lines)) stream = comments.process().stream() i = stream.read() self.assertEqual(next_value(i), " blah") self.assertEqual(next_value(i), " blah2")
def test_empty(self): comments = CxxProcessor( self.project, self.module, InputBuffer(self.test_empty.__name__, ""), ) # The stream has one newline and that's it i = comments.process().stream().read() atom = next(i) self.assertEqual(type(atom), Atom) self.assertEqual(atom.data["type"], "newline")
def test_multi_line_embedded(self): proc = CxxProcessor( self.project, self.module, InputBuffer("multiline_function_c_style", multiline_function_c_style), ) comments = proc.process().stream() i = comments.read() self.assertEqual(next_value(i), " ..class:: mxfunction") self.assertEqual(next_value(i), " *") self.assertEqual(next_value(i), " * //") self.assertEqual(next_value(i), " embedded string comment")
def test_before_and_after_empty(self): self.project.config["debug_atoms"] = True self.project.config["debug_matches"] = True comments = CxxProcessor( self.project, self.module, InputBuffer(self.test_before_and_after_empty.__name__, r" /**/ "), ) comments.process() i = comments.stream().read() self.assertEqual(next_value(i), r" ") self.assertEqual(next_value(i), r" ")