swig/Examples/test-suite/python/commentVerifier.py
Vadim Zeitlin 329d64bb04 Show the diff when a Doxygen test fails.
This is much more readable than just dumping the expected output and the
actual result produced by SWIG, especially for longer Doxygen comments.

Remove the bunch of commented out code and also do not save the results
in the file, this is not very useful as it's not even clear which test the
files correspond to and annoying when these files are left over later. If
anybody really uses this functionality, it ought to be optional.
2014-08-13 16:11:30 +02:00

8 lines
331 B
Python

def check(got, expected):
if got is None: # Absence of comment is equivalent to empty comment.
got = ''
if got != expected:
from difflib import unified_diff
diff = unified_diff(expected.splitlines(True), got.splitlines(True), "expected", "got")
raise RuntimeError("Comments don't match:\n" + "".join(diff))