Skip to content

Commit

Permalink
DocumentationComment.py: Improve assemble()
Browse files Browse the repository at this point in the history
assemble() accounts for `marker[1]==marker[2]`
Fixes coala#2645
  • Loading branch information
damngamerz committed Jun 8, 2017
1 parent e585c07 commit c79ec5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Expand Up @@ -221,6 +221,7 @@ def assemble(self):
assembled += ''.join('\n' if line == '\n' and not self.marker[1]
else self.indent + self.marker[1] + line
for line in lines[1:])
return (assembled +
(self.indent if lines[-1][-1] == '\n' else '') +
self.marker[2])
return (assembled if self.marker[1] == self.marker[2] else
(assembled +
(self.indent if lines[-1][-1] == '\n' else '') +
self.marker[2]))
Expand Up @@ -222,6 +222,13 @@ def test_python_assembly(self):
for doc in extract_documentation(data, 'python', 'default'):
self.assertIn(doc.assemble(), docs)

def test_doxygen_assembly(self):
data = load_testdata('doxygen.py')
docs = ''.join(data)

for doc in extract_documentation(data, 'python', 'doxygen'):
self.assertIn(doc.assemble(), docs)

def test_c_assembly(self):
data = load_testdata('default.c')
docs = ''.join(data)
Expand Down

0 comments on commit c79ec5a

Please sign in to comment.