import re from textwrap import dedent, indent import unittest import drake.doc.doxygen_cxx.system_doxygen as mut class TestSystemDoxygen(unittest.TestCase): def test_strip_cpp_comment_cruft(self): self.assertEqual( mut.strip_cpp_comment_cruft(dedent("""\ // This should disappear. /// comments. /// yay. /// @directive /// @enddirective // This should also disappear. """)), # N.B. For simplicity, re-indent to show the leading space. indent(dedent("""\ comments. yay. @directive @enddirective """), " "), ) self.assertEqual( mut.strip_cpp_comment_cruft(dedent("""\ * Some more comment stuff * @directive * Something // ignore * @enddirective """)), # N.B. For simplicity, re-indent to show the leading space. indent(dedent("""\ Some more comment stuff @directive Something @enddirective """), " "), ) def test_system_yaml_to_html_and_rst(self): system_yaml = dedent("""\ name: Adder input_ports: - input(0) - ... - input(N-1) - Raw html output_ports: - sum """) html = mut.system_yaml_to_html(system_yaml) self.assertIn("