[telepathy-glib/master] add tests/all-errors-documented.py

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri May 22 06:57:49 PDT 2009


---
 tests/all-errors-documented.py |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100755 tests/all-errors-documented.py

diff --git a/tests/all-errors-documented.py b/tests/all-errors-documented.py
new file mode 100755
index 0000000..da3e43c
--- /dev/null
+++ b/tests/all-errors-documented.py
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+# Check if all the errors have been added to
+# docs/reference/telepathy-glib-sections.txt
+
+import os
+import sys
+
+import xml.dom.minidom
+
+from libglibcodegen import NS_TP, camelcase_to_upper
+
+def check_all_errors_documented(abs_top_builddir):
+    error_path = os.path.join(abs_top_builddir, 'spec', 'errors.xml')
+    sections_path = os.path.join(abs_top_builddir, 'docs', 'reference',
+        'telepathy-glib-sections.txt')
+    sections = open(sections_path).readlines()
+
+    dom = xml.dom.minidom.parse(error_path)
+
+    errors = dom.getElementsByTagNameNS(NS_TP, 'errors')[0]
+    for error in errors.getElementsByTagNameNS(NS_TP, 'error'):
+        nick = error.getAttribute('name').replace(' ', '')
+        name = 'TP_ERROR_STR_' + camelcase_to_upper(nick.replace('.', ''))
+
+        if '%s\n' % name not in sections:
+            print "'%s' is missing in %s" % (name, sections_path)
+            sys.exit(1)
+
+if __name__ == '__main__':
+    check_all_errors_documented(os.environ['abs_top_builddir'])
-- 
1.5.6.5




More information about the telepathy-commits mailing list