Fix __repr__ for Diagnostic in clang.cindex
Summary: Also move misplaced tests for exception specification to fix failing Python tests.
Reviewers: hans, compnerd
Reviewed By: compnerd
Subscribers: cfe-commits
Tags: #clang-c
Differential Revision: https://reviews.llvm.org/D37490
llvm-svn: 312622
diff --git a/clang/bindings/python/tests/cindex/test_diagnostics.py b/clang/bindings/python/tests/cindex/test_diagnostics.py
index ba6e545..23cbe89 100644
--- a/clang/bindings/python/tests/cindex/test_diagnostics.py
+++ b/clang/bindings/python/tests/cindex/test_diagnostics.py
@@ -92,3 +92,11 @@
assert children[0].spelling.endswith('declared here')
assert children[0].location.line == 1
assert children[0].location.column == 1
+
+def test_diagnostic_string_repr():
+ tu = get_tu('struct MissingSemicolon{}')
+ assert len(tu.diagnostics) == 1
+ d = tu.diagnostics[0]
+
+ assert repr(d) == '<Diagnostic severity 3, location <SourceLocation file \'t.c\', line 1, column 26>, spelling "expected \';\' after struct">'
+