[gobject-introspection] giscanner: refactor GTK-Doc comment block serialization



commit 6a874b86a1b9aae0c50a30b8cd3033870797eb1c
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Tue Jul 23 17:34:07 2013 +0200

    giscanner: refactor GTK-Doc comment block serialization

 gir/gio-2.0.c                                      |   12 +-
 gir/glib-2.0.c                                     |   24 +-
 giscanner/annotationmain.py                        |    5 +-
 giscanner/annotationparser.py                      |  298 +++++++++++++-------
 .../annotationparser/gi/annotation_allow_none.xml  |    9 +
 .../annotationparser/gi/annotation_array.xml       |   59 ++++
 .../annotationparser/gi/annotation_attributes.xml  |   48 ++++
 .../annotationparser/gi/annotation_closure.xml     |   21 ++
 .../annotationparser/gi/annotation_constructor.xml |    3 +
 .../annotationparser/gi/annotation_destroy.xml     |   14 +
 .../gi/annotation_element_type.xml                 |   33 +++
 .../annotationparser/gi/annotation_foreign.xml     |    3 +
 .../gi/annotation_get_value_func.xml               |   20 ++
 .../scanner/annotationparser/gi/annotation_in.xml  |    9 +
 .../annotationparser/gi/annotation_in_out.xml      |   10 +
 .../annotationparser/gi/annotation_method.xml      |    4 +
 .../scanner/annotationparser/gi/annotation_out.xml |   24 ++
 .../annotationparser/gi/annotation_ref_func.xml    |   20 ++
 .../annotationparser/gi/annotation_rename_to.xml   |   32 ++
 .../annotationparser/gi/annotation_scope.xml       |   19 ++
 .../gi/annotation_set_value_func.xml               |   15 +
 .../annotationparser/gi/annotation_skip.xml        |   15 +
 .../annotationparser/gi/annotation_transfer.xml    |   40 +++
 .../annotationparser/gi/annotation_type.xml        |   29 ++
 .../annotationparser/gi/annotation_unref_func.xml  |   15 +
 .../annotationparser/gi/annotation_value.xml       |   15 +
 .../annotationparser/gi/annotation_virtual.xml     |   21 ++
 tests/scanner/annotationparser/gi/annotations.xml  |   85 ++++++
 tests/scanner/annotationparser/gi/identifier.xml   |   15 +
 .../annotationparser/gi/identifier_section.xml     |   57 ++++
 .../annotationparser/gi/identifier_symbol.xml      |   82 ++++++
 tests/scanner/annotationparser/gi/parameter.xml    |   58 ++++
 .../annotationparser/gi/parameter_varargs.xml      |   56 ++++
 tests/scanner/annotationparser/gi/syntax.xml       |   76 +++++
 .../annotationparser/gi/syntax_indentation.xml     |   20 ++
 .../gi/syntax_multiline_annotations.xml            |   12 +
 .../annotationparser/gi/syntax_nested_tags.xml     |   13 +
 .../gi/syntax_paragraph_breaks.xml                 |   84 ++++++
 .../annotationparser/gi/syntax_whitespace.xml      |   13 +
 tests/scanner/annotationparser/gi/tag.xml          |   60 ++++
 .../scanner/annotationparser/gi/tag_deprecated.xml |   22 ++
 .../annotationparser/gi/tag_description.xml        |   28 ++
 tests/scanner/annotationparser/gi/tag_returns.xml  |   94 ++++++
 tests/scanner/annotationparser/gi/tag_since.xml    |   28 ++
 .../scanner/annotationparser/gi/tag_stability.xml  |   38 +++
 .../gtkdoc/annotations/tester.c.xml                |   69 +++++
 .../gtkdoc/annotations/tester.h.xml                |    6 +
 .../annotationparser/gtkdoc/bugs/tester.c.xml      |  241 ++++++++++++++++
 .../annotationparser/gtkdoc/bugs/tester.h.xml      |  192 +++++++++++++
 .../annotationparser/gtkdoc/empty/tester.c.xml     |   17 +-
 .../annotationparser/gtkdoc/fail/tester.c.xml      |  212 ++++++++------
 .../annotationparser/gtkdoc/fail/tester.h.xml      |   58 ++++
 .../annotationparser/gtkdoc/gobject/giface.c.xml   |   43 +++
 .../annotationparser/gtkdoc/gobject/giface.h.xml   |   33 +++
 .../annotationparser/gtkdoc/gobject/gobject.c.xml  |  134 +++++++++
 .../annotationparser/gtkdoc/gobject/gobject.h.xml  |   43 +++
 .../annotationparser/gtkdoc/gobject/gtypes.c.xml   |    8 +
 .../annotationparser/gtkdoc/gobject/gtypes.h.xml   |   22 ++
 tests/scanner/annotationparser/test_parser.py      |   33 ++-
 59 files changed, 2554 insertions(+), 215 deletions(-)
---
diff --git a/gir/gio-2.0.c b/gir/gio-2.0.c
index e5441a4..8d90789 100644
--- a/gir/gio-2.0.c
+++ b/gir/gio-2.0.c
@@ -2076,7 +2076,7 @@
 /**
  * GSettings::change-event:
  * @settings: the object on which the signal was emitted
- * @keys: (array length=n_keys) (element-type GQuark) (allow-none): 
+ * @keys: (array length=n_keys) (element-type GQuark) (allow-none):
  *        an array of #GQuark<!-- -->s for the changed keys, or %NULL
  * @n_keys: the length of the @keys array, or 0
  *
@@ -10621,7 +10621,7 @@
  * g_app_info_add_supports_type(), but only those exported directly by
  * the application.
  *
- * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): 
+ * Returns: (transfer none) (array zero-terminated=1) (element-type utf8):
  *    a list of content types.
  * Since: 2.34
  */
@@ -11973,7 +11973,7 @@
  * buffer must not be modified and will become invalid when reading from
  * the stream or filling the buffer.
  *
- * Returns: (array length=count) (element-type guint8) (transfer none): 
+ * Returns: (array length=count) (element-type guint8) (transfer none):
  *          read-only buffer
  */
 
@@ -28626,7 +28626,7 @@
  * @path: (out): the location to save the path
  * @keys: (out) (transfer container) (array zero-terminated=1): the
  *        location to save the relative keys
- * @values: (out) (allow-none) (transfer container) (array zero-terminated=1): 
+ * @values: (out) (allow-none) (transfer container) (array zero-terminated=1):
  *          the location to save the values, or %NULL
  *
  * Calculate the longest common prefix of all keys in a tree and write
@@ -35713,7 +35713,7 @@
  * allowing for checking if the mounts have changed with
  * g_unix_mount_points_changed_since().
  *
- * Returns: (element-type GUnixMountPoint) (transfer full): 
+ * Returns: (element-type GUnixMountPoint) (transfer full):
  *     a #GList of the UNIX mountpoints.
  */
 
@@ -35737,7 +35737,7 @@
  * timestamp, allowing for checking if the mounts have changed
  * with g_unix_mounts_changed_since().
  *
- * Returns: (element-type GUnixMountEntry) (transfer full): 
+ * Returns: (element-type GUnixMountEntry) (transfer full):
  *     a #GList of the UNIX mounts.
  */
 
diff --git a/gir/glib-2.0.c b/gir/glib-2.0.c
index d539fb3..a6fd04b 100644
--- a/gir/glib-2.0.c
+++ b/gir/glib-2.0.c
@@ -9896,7 +9896,7 @@
  * that the returned binary data is not necessarily zero-terminated,
  * so it should not be used as a character string.
  *
- * Returns: (transfer full) (array length=out_len) (element-type guint8): 
+ * Returns: (transfer full) (array length=out_len) (element-type guint8):
  *               newly allocated buffer containing the binary data
  *               that @text represents. The returned buffer must
  *               be freed with g_free().
@@ -11194,7 +11194,7 @@
 
 /**
  * g_bytes_new:
- * @data: (transfer none) (array length=size) (element-type guint8): 
+ * @data: (transfer none) (array length=size) (element-type guint8):
  *        the data to be used for the bytes
  * @size: the size of @data
  *
@@ -11226,7 +11226,7 @@
 
 /**
  * g_bytes_new_static: (skip)
- * @data: (transfer full) (array length=size) (element-type guint8): 
+ * @data: (transfer full) (array length=size) (element-type guint8):
  *           the data to be used for the bytes
  * @size: the size of @data
  *
@@ -11241,7 +11241,7 @@
 
 /**
  * g_bytes_new_take:
- * @data: (transfer full) (array length=size) (element-type guint8): 
+ * @data: (transfer full) (array length=size) (element-type guint8):
  *           the data to be used for the bytes
  * @size: the size of @data
  *
@@ -14804,7 +14804,7 @@
  * on other platforms, this function indirectly depends on the
  * <link linkend="setlocale">current locale</link>.
  *
- * Returns: (array length=bytes_written) (element-type guint8) (transfer full): 
+ * Returns: (array length=bytes_written) (element-type guint8) (transfer full):
  *               The converted string, or %NULL on an error.
  */
 
@@ -16939,7 +16939,7 @@
 /**
  * g_io_channel_read_chars:
  * @channel: a #GIOChannel
- * @buf: (out caller-allocates) (array length=count) (element-type guint8): 
+ * @buf: (out caller-allocates) (array length=count) (element-type guint8):
  *     a buffer to read data into
  * @count: (in): the size of the buffer. Note that the buffer may not be
  *     complelely filled even if there is data in the buffer if the
@@ -17449,7 +17449,7 @@
  * with @key cannot be interpreted as booleans then %NULL is returned
  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
  *
- * Returns: (array length=length) (element-type gboolean) (transfer container): 
+ * Returns: (array length=length) (element-type gboolean) (transfer container):
  *    the values associated with the key as a list of booleans, or %NULL if the
  *    key was not found or could not be parsed. The returned list of booleans
  *    should be freed with g_free() when no longer needed.
@@ -17511,7 +17511,7 @@
  * with @key cannot be interpreted as doubles then %NULL is returned
  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
  *
- * Returns: (array length=length) (element-type gdouble) (transfer container): 
+ * Returns: (array length=length) (element-type gdouble) (transfer container):
  *     the values associated with the key as a list of doubles, or %NULL if the
  *     key was not found or could not be parsed. The returned list of doubles
  *     should be freed with g_free() when no longer needed.
@@ -17588,7 +17588,7 @@
  * with @key cannot be interpreted as integers then %NULL is returned
  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
  *
- * Returns: (array length=length) (element-type gint) (transfer container): 
+ * Returns: (array length=length) (element-type gint) (transfer container):
  *     the values associated with the key as a list of integers, or %NULL if
  *     the key was not found or could not be parsed. The returned list of
  *     integers should be freed with g_free() when no longer needed.
@@ -17713,7 +17713,7 @@
  * event that the @group_name cannot be found, %NULL is returned
  * and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
  *
- * Returns: (array zero-terminated=1 length=length) (element-type utf8) (transfer full): 
+ * Returns: (array zero-terminated=1 length=length) (element-type utf8) (transfer full):
  *  a %NULL-terminated string array or %NULL if the specified
  *  key cannot be found. The array should be freed with g_strfreev().
  * Since: 2.6
@@ -32539,7 +32539,7 @@
  *
  * The return value must be freed using g_free().
  *
- * Returns: (transfer full) (array zero-terminated=1 length=length) (element-type guint8): 
+ * Returns: (transfer full) (array zero-terminated=1 length=length) (element-type guint8):
  *          a newly allocated string
  * Since: 2.26
  */
@@ -32715,7 +32715,7 @@
  *
  * The return value remains valid as long as @value exists.
  *
- * Returns: (transfer none) (array zero-terminated=1) (element-type guint8): 
+ * Returns: (transfer none) (array zero-terminated=1) (element-type guint8):
  *          the constant string
  * Since: 2.26
  */
diff --git a/giscanner/annotationmain.py b/giscanner/annotationmain.py
index 8756dcd..618cf47 100644
--- a/giscanner/annotationmain.py
+++ b/giscanner/annotationmain.py
@@ -21,7 +21,7 @@
 import optparse
 
 from giscanner import message
-from giscanner.annotationparser import GtkDocCommentBlockParser
+from giscanner.annotationparser import GtkDocCommentBlockParser, GtkDocCommentBlockWriter
 from giscanner.scannermain import (get_preprocessor_option_group,
                                    create_source_scanner,
                                    process_packages)
@@ -59,13 +59,14 @@ def annotation_main(args):
 
     if options.extract:
         parser = GtkDocCommentBlockParser()
+        writer = GtkDocCommentBlockWriter(indent=False)
         blocks = parser.parse_comment_blocks(ss.get_comments())
         print '/' + ('*' * 60) + '/'
         print '/* THIS FILE IS GENERATED DO NOT EDIT */'
         print '/' + ('*' * 60) + '/'
         print
         for block in sorted(blocks.values()):
-            print block.to_gtk_doc()
+            print writer.write(block)
             print
         print
         print '/' + ('*' * 60) + '/'
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index e37fbe8..84d3eb2 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -882,31 +882,6 @@ class GtkDocParameter(GtkDocAnnotatable):
     def __repr__(self):
         return '<GtkDocParameter %r %r>' % (self.name, self.annotations)
 
-    def _get_gtk_doc_value(self):
-        def serialize_one(option, value, fmt, fmt2):
-            if value:
-                if type(value) != str:
-                    if isinstance(value, list):
-                        value = ' '.join(value)
-                    else:
-                        value = ' '.join((serialize_one(k, v, '%s=%s', '%s')
-                                          for k, v in value.items()))
-                return fmt % (option, value)
-            else:
-                return fmt2 % (option, )
-        serialized = ''
-        annotations = []
-        for ann_name, options in self.annotations.items():
-            annotations.append(serialize_one(ann_name, options, '(%s %s)', '(%s)'))
-        if annotations:
-            serialized += ' '.join(annotations)
-        if self.description and annotations:
-            serialized += ': '
-        return serialized
-
-    def to_gtk_doc(self):
-        return '@%s: %s%s' % (self.name, self._get_gtk_doc_value(), self.description)
-
 
 class GtkDocTag(GtkDocAnnotatable):
     '''
@@ -933,37 +908,6 @@ class GtkDocTag(GtkDocAnnotatable):
     def __repr__(self):
         return '<GtkDocTag %r %r>' % (self.name, self.annotations)
 
-    def _get_gtk_doc_value(self):
-        def serialize_one(option, value, fmt, fmt2):
-            if value:
-                if type(value) != str:
-                    if isinstance(value, list):
-                        value = ' '.join(value)
-                    else:
-                        value = ' '.join((serialize_one(k, v, '%s=%s', '%s')
-                                          for k, v in value.items()))
-                return fmt % (option, value)
-            else:
-                return fmt2 % (option, )
-        serialized = ''
-        annotations = []
-        for ann_name, options in self.annotations.items():
-            annotations.append(serialize_one(ann_name, options, '(%s %s)', '(%s)'))
-        if annotations:
-            serialized += ' '.join(annotations)
-        if self.value and annotations:
-            serialized += ': '
-        if self.value:
-            serialized += self.value
-        if self.description and (annotations or self.value):
-            serialized += ': '
-        return serialized
-
-    def to_gtk_doc(self):
-        return '%s: %s%s' % (self.name.capitalize(),
-                             self._get_gtk_doc_value(),
-                             self.description or '')
-
 
 class GtkDocCommentBlock(GtkDocAnnotatable):
     '''
@@ -1014,53 +958,6 @@ class GtkDocCommentBlock(GtkDocAnnotatable):
     def __repr__(self):
         return '<GtkDocCommentBlock %r %r>' % (self.name, self.annotations)
 
-    def to_gtk_doc(self):
-        def serialize_one(option, value, fmt, fmt2):
-            if value:
-                if type(value) != str:
-                    if isinstance(value, list):
-                        value = ' '.join(value)
-                    else:
-                        value = ' '.join((serialize_one(k, v, '%s=%s', '%s')
-                                          for k, v in value.items()))
-                return fmt % (option, value)
-            else:
-                return fmt2 % (option, )
-
-        lines = [self.name]
-        if 'SECTION' not in self.name:
-            lines[0] += ':'
-
-        annotations = []
-        for ann_name, options in self.annotations.items():
-            annotations.append(serialize_one(ann_name, options, '(%s %s)', '(%s)'))
-        if annotations:
-            annotations = ' '.join(annotations)
-            lines[0] += ' ' + annotations
-
-        for param in self.params.values():
-            for l in param.to_gtk_doc().split('\n'):
-                lines.append(l)
-        if self.description:
-            lines.append('')
-            for l in self.description.split('\n'):
-                lines.append(l)
-        if self.tags:
-            lines.append('')
-            for tag in self.tags.values():
-                for l in tag.to_gtk_doc().split('\n'):
-                    lines.append(l)
-
-        comment = ''
-        comment += '/**\n'
-        for line in lines:
-            if line:
-                comment += ' * %s\n' % (line, )
-            else:
-                comment += ' *\n'
-        comment += ' */\n'
-        return comment
-
     def validate(self):
         '''
         Validate annotations applied to the :class:`GtkDocCommentBlock` identifier, parameters
@@ -1957,3 +1854,198 @@ class GtkDocCommentBlockParser(object):
                              position)
 
         return (annotations, description_field)
+
+
+class GtkDocCommentBlockWriter(object):
+    '''
+    Serialized :class:`GtkDocCommentBlock` objects into GTK-Doc comment blocks.
+    '''
+
+    def __init__(self, indent=True):
+        #: :const:`True` if the original indentation preceding the "``*``" needs to be retained,
+        #: :const:`False` otherwise. Default value is :const:`True`.
+        self.indent = indent
+
+    def _serialize_annotations(self, annotations):
+        '''
+        Serialize an annotation field. For example::
+
+            ┌──────────────────────────────────────────────────────────────┐
+            │ {'name': {'opt1': 'value1', 'opt2':'value2', 'opt3':None}    │ ◁─ GtkDocAnnotations
+            ├──────────────────────────────────────────────────────────────┤
+            │ '(name opt1=value1 opt2=value2 opt3)'                        │ ─▷ serialized
+            └──────────────────────────────────────────────────────────────┘
+
+            ┌──────────────────────────────────────────────────────────────┐
+            │ {'name': ['opt1', 'opt2']}                                   │ ◁─ GtkDocAnnotations
+            ├──────────────────────────────────────────────────────────────┤
+            │ '(name opt1 opt2)'                                           │ ─▷ serialized
+            └──────────────────────────────────────────────────────────────┘
+
+            ┌──────────────────────────────────────────────────────────────┐
+            │ {'unkownname': ['unknown list of options']}                  │ ◁─ GtkDocAnnotations
+            ├──────────────────────────────────────────────────────────────┤
+            │ '(unkownname unknown list of options)'                       │ ─▷ serialized
+            └──────────────────────────────────────────────────────────────┘
+
+        :param annotations: :class:`GtkDocAnnotations` to be serialized
+        :returns: a string
+        '''
+
+        serialized = []
+
+        for ann_name, options in annotations.items():
+            if options:
+                if isinstance(options, list):
+                    serialize_options = ' '.join(options)
+                else:
+                    serialize_options = ''
+
+                    for key, value in options.items():
+                        if value:
+                            serialize_options += '%s=%s ' % (key, value)
+                        else:
+                            serialize_options += '%s ' % (key, )
+
+                    serialize_options = serialize_options.strip()
+
+                serialized.append('(%s %s)' % (ann_name, serialize_options))
+            else:
+                serialized.append('(%s)' % (ann_name, ))
+
+        return ' '.join(serialized)
+
+    def _serialize_parameter(self, parameter):
+        '''
+        Serialize a parameter.
+
+        :param parameter: :class:`GtkDocParameter` to be serialized
+        :returns: a string
+        '''
+
+        # parameter_name field
+        serialized = '@%s' % (parameter.name, )
+
+        # annotations field
+        if parameter.annotations:
+            serialized += ': ' + self._serialize_annotations(parameter.annotations)
+
+        # description field
+        if parameter.description:
+            if parameter.description.startswith('\n'):
+                serialized += ':' + parameter.description
+            else:
+                serialized += ': ' + parameter.description
+        else:
+            serialized += ':'
+
+        return serialized.split('\n')
+
+    def _serialize_tag(self, tag):
+        '''
+        Serialize a tag.
+
+        :param tag: :class:`GtkDocTag` to be serialized
+        :returns: a string
+        '''
+
+        # tag_name field
+        serialized = tag.name.capitalize()
+
+        # annotations field
+        if tag.annotations:
+            serialized += ': ' + self._serialize_annotations(tag.annotations)
+
+        # value field
+        if tag.value:
+            serialized += ': ' + tag.value
+
+        # description field
+        if tag.description:
+            if tag.description.startswith('\n'):
+                serialized += ':' + tag.description
+            else:
+                serialized += ': ' + tag.description
+
+        if not tag.value and not tag.description:
+            serialized += ':'
+
+        return serialized.split('\n')
+
+    def write(self, block):
+        '''
+        Serialize a :class:`GtkDocCommentBlock` object.
+
+        :param block: :class:`GtkDocCommentBlock` to be serialized
+        :returns: a string
+        '''
+
+        if block is None:
+            return ''
+        else:
+            lines = []
+
+            # Identifier part
+            if block.name.startswith('SECTION'):
+                lines.append(block.name)
+            else:
+                if block.annotations:
+                    annotations = self._serialize_annotations(block.annotations)
+                    lines.append('%s: %s' % (block.name, annotations))
+                else:
+                    # Note: this delimiter serves no purpose other than most people being used
+                    #       to reading/writing it. It is completely legal to ommit this.
+                    lines.append('%s:' % (block.name, ))
+
+            # Parameter parts
+            for param in block.params.values():
+                lines.extend(self._serialize_parameter(param))
+
+            # Comment block description part
+            if block.description:
+                lines.append('')
+                for l in block.description.split('\n'):
+                    lines.append(l)
+
+            # Tag parts
+            if block.tags:
+                # Note: this empty line servers no purpose other than most people being used
+                #       to reading/writing it. It is completely legal to ommit this.
+                lines.append('')
+                for tag in block.tags.values():
+                    lines.extend(self._serialize_tag(tag))
+
+            # Restore comment block indentation and *
+            if self.indent:
+                indent = Counter(block.indentation).most_common(1)[0][0] or ' '
+                if indent.endswith('\t'):
+                    start_indent = indent
+                    line_indent = indent + ' '
+                else:
+                    start_indent = indent[:-1]
+                    line_indent = indent
+            else:
+                start_indent = ''
+                line_indent = ' '
+
+            i = 0
+            while i < len(lines):
+                line = lines[i]
+                if line:
+                    lines[i] = '%s* %s\n' % (line_indent, line)
+                else:
+                    lines[i] = '%s*\n' % (line_indent, )
+                i += 1
+
+            # Restore comment block start and end tokens
+            lines.insert(0, '%s/**\n' % (start_indent, ))
+            lines.append('%s*/\n' % (line_indent, ))
+
+            # Restore code before and after comment block start and end tokens
+            if block.code_before:
+                lines.insert(0, '%s\n' % (block.code_before, ))
+
+            if block.code_after:
+                lines.append('%s\n' % (block.code_after, ))
+
+            return ''.join(lines)
diff --git a/tests/scanner/annotationparser/gi/annotation_allow_none.xml 
b/tests/scanner/annotationparser/gi/annotation_allow_none.xml
index 7c9c3b3..ae6b3b3 100644
--- a/tests/scanner/annotationparser/gi/annotation_allow_none.xml
+++ b/tests/scanner/annotationparser/gi/annotation_allow_none.xml
@@ -49,6 +49,15 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_inout:
+ * @object: a #GObject
+ * @inoutarg: (inout) (allow-none): This is an argument test
+ *
+ * This is a test for out arguments
+ *
+ * Returns: (allow-none): an int
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml 
b/tests/scanner/annotationparser/gi/annotation_array.xml
index bf00191..3a7cbc0 100644
--- a/tests/scanner/annotationparser/gi/annotation_array.xml
+++ b/tests/scanner/annotationparser/gi/annotation_array.xml
@@ -28,6 +28,12 @@
       <description>Test taking a zero-terminated array</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_compute_sum:
+ * @nums: (array): Sequence of numbers
+ *
+ * Test taking a zero-terminated array
+ */</output>
 </test>
 
 <test>
@@ -78,6 +84,15 @@
       <description>Test taking an array with length parameter</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_compute_sum_n:
+ * @object: a #AnnotationObject
+ * @nums: (array length=n_nums zero-terminated=0): Sequence of
+ *   numbers that are zero-terminated
+ * @n_nums: Length of number array
+ *
+ * Test taking an array with length parameter
+ */</output>
 </test>
 
 <test>
@@ -128,6 +143,15 @@ are zero-terminated</description>
       <description>Test taking a zero-terminated array with length parameter</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_compute_sum_nz:
+ * @object: a #AnnotationObject
+ * @nums: (array length=n_nums zero-terminated=1): Sequence of numbers that
+ * are zero-terminated
+ * @n_nums: Length of number array
+ *
+ * Test taking a zero-terminated array with length parameter
+ */</output>
 </test>
 
 <test>
@@ -184,6 +208,14 @@ are zero-terminated</description>
       <description>Test taking a zero-terminated array with length parameter</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_parse_args:
+ * @object: a #AnnotationObject
+ * @argc: (inout): Length of the argument vector
+ * @argv: (inout) (array length=argc zero-terminated=1): Argument vector
+ *
+ * Test taking a zero-terminated array with length parameter
+ */</output>
 </test>
 
 <test>
@@ -228,6 +260,14 @@ are zero-terminated</description>
       <description>Test taking a guchar * with a length.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_set_data:
+ * @object: a #AnnotationObject
+ * @data: (array length=length): The data
+ * @length: Length of the data
+ *
+ * Test taking a guchar * with a length.
+ */</output>
 </test>
 
 <test>
@@ -286,6 +326,12 @@ are zero-terminated</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_string_zero_terminated:
+ * @data: (array fixed-size=2): a third value
+ *
+ * Returns: (transfer full) (array zero-terminated=1): The return value
+ */</output>
 </test>
 
 <test>
@@ -350,6 +396,12 @@ are zero-terminated</description>
       <message>3: Warning: Test: invalid "array" annotation option: "invalid"</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_string_zero_terminated:
+ * @data: (array invalid fixed-size=2): a third value
+ *
+ * Returns: (transfer full) (array zero-terminated=1): The return value
+ */</output>
 </test>
 
 <test>
@@ -419,6 +471,13 @@ are zero-terminated</description>
       <message>6: Warning: Test: invalid "array" annotation option "zero-terminated" value "yes", must be an 
integer</message>
     </messages>
   </parser>
+  <output>/**
+ * g_app_launch_context_get_environment:
+ * @arg1: (array zero-terminated): ...
+ * @arg2: (array length): ...
+ *
+ * Returns: (array zero-terminated=yes): the child's environment
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_attributes.xml 
b/tests/scanner/annotationparser/gi/annotation_attributes.xml
index 04372e4..e9d9b42 100644
--- a/tests/scanner/annotationparser/gi/annotation_attributes.xml
+++ b/tests/scanner/annotationparser/gi/annotation_attributes.xml
@@ -34,6 +34,11 @@
       <description>This is an object used to test annotations.</description>
     </docblock>
   </parser>
+  <output>/**
+ * AnnotationObject: (attributes org.example.test1=horses org.example.test2 org.example.test3=cows)
+ *
+ * This is an object used to test annotations.
+ */</output>
 </test>
 
 <test>
@@ -78,6 +83,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * AnnotationObject: (attributes org.example.test1=horses org.example.test2 org.example.test3=cows)
+ *
+ * This is an object used to test annotations.
+ */</output>
 </test>
 
 <test>
@@ -153,6 +163,11 @@ Attributes: (org.example.test1 horses))
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * AnnotationObject: (attributes org.example.test1=horses)
+ *
+ * This is an object used to test annotations.
+ */</output>
 </test>
 
 <test>
@@ -194,6 +209,11 @@ Attributes: (org.example.test1 horses))
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * AnnotationObject: (attributes org.example.Test=horses org.example.test2=cows)
+ *
+ * This is an object used to test annotations.
+ */</output>
 </test>
 
 <test>
@@ -220,6 +240,11 @@ Attributes: (org.example.test1 horses))
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * AnnotationObject:
+ *
+ * This is an object used to test annotations.
+ */</output>
 </test>
 
 <test>
@@ -310,6 +335,17 @@ Attributes: (org.example.test1 horses))
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * AnnotationObject::attribute-signal:
+ * @annotation: the annotation object
+ * @arg1: (attributes some.annotation.foo1=val1): a value
+ * @arg2: (attributes some.annotation.foo2=val2): another value
+ * @arg3: (array fixed-size=2): a third value
+ *
+ * This signal tests a signal with attributes.
+ *
+ * Returns: (attributes some.annotation.foo3=val3): the return value
+ */</output>
 </test>
 
 <test>
@@ -424,6 +460,18 @@ Attributes: (org.example.test1 horses))
             ^</message>
     </messages>
   </parser>
+  <output>/**
+ * AnnotationObject::attribute-signal:
+ * @annotation: the annotation object
+ * @arg1: (attributes some.annotation.foo1): a value
+ * @arg2: (attributes some.annotation.foo2=val2): another value
+ * @arg3: something special
+ * @arg4: (array fixed-size=2): a third value
+ *
+ * This signal tests a signal with attributes.
+ *
+ * Returns: (attributes some.annotation.foo3=val3): the return value
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_closure.xml 
b/tests/scanner/annotationparser/gi/annotation_closure.xml
index c778e6a..f67862c 100644
--- a/tests/scanner/annotationparser/gi/annotation_closure.xml
+++ b/tests/scanner/annotationparser/gi/annotation_closure.xml
@@ -30,6 +30,13 @@
 'user_data' and hence has to be annotated.</description>
     </docblock>
   </parser>
+  <output>/**
+ * AnnotationNotifyFunc:
+ * @data: (closure): The user data
+ *
+ * This is a callback with a 'closure' argument that is not named
+ * 'user_data' and hence has to be annotated.
+ */</output>
 </test>
 
 <test>
@@ -73,6 +80,13 @@
 detection, and fixing it via annotations.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_custom_destroy:
+ * @callback: (destroy destroy) (closure data): Destroy notification
+ *
+ * Test messing up the heuristic of closure/destroy-notification
+ * detection, and fixing it via annotations.
+ */</output>
 </test>
 
 <test>
@@ -121,6 +135,13 @@ detection, and fixing it via annotations.</description>
                                              ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_custom_destroy:
+ * @callback: (destroy destroy) (closure data=invalid): Destroy notification
+ *
+ * Test messing up the heuristic of closure/destroy-notification
+ * detection, and fixing it via annotations.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_constructor.xml 
b/tests/scanner/annotationparser/gi/annotation_constructor.xml
index 65ee93d..8c0aeb2 100644
--- a/tests/scanner/annotationparser/gi/annotation_constructor.xml
+++ b/tests/scanner/annotationparser/gi/annotation_constructor.xml
@@ -18,6 +18,9 @@
       </identifier>
     </docblock>
   </parser>
+  <output>/**
+ * regress_constructor: (constructor)
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_destroy.xml 
b/tests/scanner/annotationparser/gi/annotation_destroy.xml
index bb81220..e504a96 100644
--- a/tests/scanner/annotationparser/gi/annotation_destroy.xml
+++ b/tests/scanner/annotationparser/gi/annotation_destroy.xml
@@ -43,6 +43,13 @@
 detection, and fixing it via annotations.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_custom_destroy:
+ * @callback: (destroy destroy) (closure data): Destroy notification
+ *
+ * Test messing up the heuristic of closure/destroy-notification
+ * detection, and fixing it via annotations.
+ */</output>
 </test>
 
 <test>
@@ -91,6 +98,13 @@ detection, and fixing it via annotations.</description>
                               ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_custom_destroy:
+ * @callback: (destroy destroy=invalid) (closure data): Destroy notification
+ *
+ * Test messing up the heuristic of closure/destroy-notification
+ * detection, and fixing it via annotations.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_element_type.xml 
b/tests/scanner/annotationparser/gi/annotation_element_type.xml
index 2e1f945..65b3dd0 100644
--- a/tests/scanner/annotationparser/gi/annotation_element_type.xml
+++ b/tests/scanner/annotationparser/gi/annotation_element_type.xml
@@ -74,6 +74,13 @@
       <message>4: Warning: Test: "element-type" annotation takes at most 2 options, 3 given</message>
     </messages>
   </parser>
+  <output>/**
+ * foo_test_array:
+ * @a: (element-type):
+ * @b: (element-type x y z):
+ *
+ * Returns: (element-type utf8) (transfer container): returns %NULL.
+ */</output>
 </test>
 
 <test>
@@ -116,6 +123,14 @@
  TpAccount::status-changed</description>
     </docblock>
   </parser>
+  <output>/**
+ * RegressTestObj::sig-with-hash-prop:
+ * @self: an object
+ * @hash: (element-type utf8 GObject.Value):
+ *
+ * This test signal is like TelepathyGlib's
+ *  TpAccount::status-changed
+ */</output>
 </test>
 
 <test>
@@ -162,6 +177,14 @@ element-type annotation.</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * regress_test_ghash_nested_everything_return2:
+ *
+ * Another way of specifying nested parameterized types: using the
+ * element-type annotation.
+ *
+ * Returns: (element-type utf8 GLib.HashTable(utf8,utf8)) (transfer full):
+ */</output>
 </test>
 
 <test>
@@ -198,6 +221,11 @@ element-type annotation.</description>
                                        ^</message>
     </messages>
   </parser>
+  <output> /**
+  * foo_test_array:
+  *
+  * Returns: (element-type invalid utf8=invalid GLib.HashTable(utf8,utf8)): returns %NULL.
+  */</output>
 </test>
 
 <test>
@@ -234,6 +262,11 @@ element-type annotation.</description>
                                ^</message>
     </messages>
   </parser>
+  <output> /**
+  * foo_test_array:
+  *
+  * Returns: (element-type utf8=invalid GLib.HashTable(utf8,utf8) invalid): returns %NULL.
+  */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_foreign.xml 
b/tests/scanner/annotationparser/gi/annotation_foreign.xml
index 2f90ac1..e65e974 100644
--- a/tests/scanner/annotationparser/gi/annotation_foreign.xml
+++ b/tests/scanner/annotationparser/gi/annotation_foreign.xml
@@ -19,6 +19,9 @@
       </identifier>
     </docblock>
   </parser>
+  <output>/**
+ * FooForeignStruct: (foreign)
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_get_value_func.xml 
b/tests/scanner/annotationparser/gi/annotation_get_value_func.xml
index 7d1551f..3e96f83 100644
--- a/tests/scanner/annotationparser/gi/annotation_get_value_func.xml
+++ b/tests/scanner/annotationparser/gi/annotation_get_value_func.xml
@@ -26,6 +26,11 @@
       <description>This object tests regressions...</description>
     </docblock>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -62,6 +67,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -98,6 +108,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -129,6 +144,11 @@
                                                                                           ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object=invalid)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_in.xml 
b/tests/scanner/annotationparser/gi/annotation_in.xml
index 4e9be4f..26daf5a 100644
--- a/tests/scanner/annotationparser/gi/annotation_in.xml
+++ b/tests/scanner/annotationparser/gi/annotation_in.xml
@@ -49,6 +49,15 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_in:
+ * @object: a #GObject
+ * @inarg: (in) (transfer none): This is an argument test
+ *
+ * This is a test for in arguments
+ *
+ * Returns: an int
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_in_out.xml 
b/tests/scanner/annotationparser/gi/annotation_in_out.xml
index 5530a6a..1900229 100644
--- a/tests/scanner/annotationparser/gi/annotation_in_out.xml
+++ b/tests/scanner/annotationparser/gi/annotation_in_out.xml
@@ -56,6 +56,16 @@
                ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_object_inout:
+ * @object: a #GObject
+ * @inoutarg: (inout): This is an argument test
+ * @inoutarg2: (inout): This is an argument test
+ *
+ * This is a test for inout arguments
+ *
+ * Returns: an int
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_method.xml 
b/tests/scanner/annotationparser/gi/annotation_method.xml
index 37c910c..3b9f1b8 100644
--- a/tests/scanner/annotationparser/gi/annotation_method.xml
+++ b/tests/scanner/annotationparser/gi/annotation_method.xml
@@ -25,6 +25,10 @@
       </parameters>
     </docblock>
   </parser>
+  <output>/**
+ * regress_forced_method: (method)
+ * @obj: A #RegressTestObj
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_out.xml 
b/tests/scanner/annotationparser/gi/annotation_out.xml
index b5d08d5..7bfc863 100644
--- a/tests/scanner/annotationparser/gi/annotation_out.xml
+++ b/tests/scanner/annotationparser/gi/annotation_out.xml
@@ -41,6 +41,15 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_out:
+ * @object: a #GObject
+ * @outarg: (out): This is an argument test
+ *
+ * This is a test for out arguments
+ *
+ * Returns: an int
+ */</output>
 </test>
 
 <test>
@@ -76,6 +85,11 @@
       </parameters>
     </docblock>
   </parser>
+  <output>/**
+ * regress_test_struct_a_clone:
+ * @a: the structure
+ * @a_out: (out caller-allocates): the cloned structure
+ */</output>
 </test>
 
 <test>
@@ -111,6 +125,11 @@
       </parameters>
     </docblock>
   </parser>
+  <output>/**
+ * regress_test_struct_a_clone:
+ * @a: the structure
+ * @a_out: (out callee-allocates): the cloned structure
+ */</output>
 </test>
 
 <test>
@@ -163,6 +182,11 @@
       <message>4: Warning: Test: invalid "out" annotation option: "callee-allocates=invalid"</message>
     </messages>
   </parser>
+  <output>/**
+ * regress_test_struct_a_clone:
+ * @a: (out invalid): the structure
+ * @a_out: (out callee-allocates=invalid): the cloned structure
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_ref_func.xml 
b/tests/scanner/annotationparser/gi/annotation_ref_func.xml
index c97683b..a967102 100644
--- a/tests/scanner/annotationparser/gi/annotation_ref_func.xml
+++ b/tests/scanner/annotationparser/gi/annotation_ref_func.xml
@@ -26,6 +26,11 @@
       <description>This object tests regressions...</description>
     </docblock>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -62,6 +67,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -98,6 +108,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -129,6 +144,11 @@
                                                                               ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref=invalid)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_rename_to.xml 
b/tests/scanner/annotationparser/gi/annotation_rename_to.xml
index 9fecdaf..2987d88 100644
--- a/tests/scanner/annotationparser/gi/annotation_rename_to.xml
+++ b/tests/scanner/annotationparser/gi/annotation_rename_to.xml
@@ -48,6 +48,15 @@
       <description>Test overriding via the "Rename To" annotation.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_watch_full: (rename-to annotation_object_watch)
+ * @object: A #AnnotationObject
+ * @func: The callback
+ * @user_data: The callback data
+ * @destroy: Destroy notification
+ *
+ * Test overriding via the "Rename To" annotation.
+ */</output>
 </test>
 
 <test>
@@ -106,6 +115,15 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_object_watch_full: (rename-to annotation_object_watch)
+ * @object: A #AnnotationObject
+ * @func: The callback
+ * @user_data: The callback data
+ * @destroy: Destroy notification
+ *
+ * Test overriding via the "Rename To" annotation.
+ */</output>
 </test>
 
 <test>
@@ -142,6 +160,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_object_watch_full: (rename-to annotation_object_watch)
+ *
+ * Test overriding via the "Rename To" annotation.
+ */</output>
 </test>
 
 <test>
@@ -195,6 +218,15 @@
                                                                    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_object_watch_full: (rename-to annotation_object_watch=invalid)
+ * @object: A #AnnotationObject
+ * @func: The callback
+ * @user_data: The callback data
+ * @destroy: Destroy notification
+ *
+ * Test overriding via the "Rename To" annotation.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_scope.xml 
b/tests/scanner/annotationparser/gi/annotation_scope.xml
index 008591d..3a22274 100644
--- a/tests/scanner/annotationparser/gi/annotation_scope.xml
+++ b/tests/scanner/annotationparser/gi/annotation_scope.xml
@@ -43,6 +43,14 @@
       <description>Test taking a call-scoped callback</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_foreach:
+ * @object: a #AnnotationObject
+ * @func: (scope call): Callback to invoke
+ * @user_data: Callback user data
+ *
+ * Test taking a call-scoped callback
+ */</output>
 </test>
 
 <test>
@@ -77,6 +85,13 @@
 is invoked.</description>
     </docblock>
   </parser>
+  <output>/**
+ * regress_test_callback_destroy_notify:
+ * @callback: (scope notified):
+ *
+ * Notified - callback persists until a DestroyNotify delegate
+ * is invoked.
+ */</output>
 </test>
 
 <test>
@@ -107,6 +122,10 @@ is invoked.</description>
       </parameters>
     </docblock>
   </parser>
+  <output>/**
+ * regress_test_callback_async:
+ * @callback: (scope async):
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_set_value_func.xml 
b/tests/scanner/annotationparser/gi/annotation_set_value_func.xml
index 4619fb9..f98944b 100644
--- a/tests/scanner/annotationparser/gi/annotation_set_value_func.xml
+++ b/tests/scanner/annotationparser/gi/annotation_set_value_func.xml
@@ -26,6 +26,11 @@
       <description>This object tests regressions...</description>
     </docblock>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (set-value-func regress_test_value_set_fundamental_object)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -62,6 +67,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (set-value-func regress_test_value_set_fundamental_object)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -98,6 +108,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (set-value-func regress_test_value_set_fundamental_object)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_skip.xml 
b/tests/scanner/annotationparser/gi/annotation_skip.xml
index ed8e75b..e0352e0 100644
--- a/tests/scanner/annotationparser/gi/annotation_skip.xml
+++ b/tests/scanner/annotationparser/gi/annotation_skip.xml
@@ -40,6 +40,15 @@
 annotation_object_watch_full().</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_watch: (skip)
+ * @object: A #AnnotationObject
+ * @func: The callback
+ * @user_data: The callback data
+ *
+ * This is here just for the sake of being overriden by its
+ * annotation_object_watch_full().
+ */</output>
 </test>
 
 <test>
@@ -71,6 +80,12 @@ annotation_object_watch_full().</description>
       <message>2: Warning: Test: "skip" annotation needs no options, 1 given</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_object_watch: (skip yes)
+ *
+ * This is here just for the sake of being overriden by its
+ * annotation_object_watch_full().
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_transfer.xml 
b/tests/scanner/annotationparser/gi/annotation_transfer.xml
index 3bbb8c4..9b4ded1 100644
--- a/tests/scanner/annotationparser/gi/annotation_transfer.xml
+++ b/tests/scanner/annotationparser/gi/annotation_transfer.xml
@@ -56,6 +56,14 @@
 known by GObject as it's only marked as G_TYPE_POINTER</description>
     </docblock>
   </parser>
+  <output>/**
+ * AnnotationObject::list-signal:
+ * @annotation: the annotation object
+ * @list: (type GLib.List) (element-type utf8) (transfer container): a list of strings
+ *
+ * This is a signal which takes a list of strings, but it's not
+ * known by GObject as it's only marked as G_TYPE_POINTER
+ */</output>
 </test>
 
 <test>
@@ -105,6 +113,15 @@ known by GObject as it's only marked as G_TYPE_POINTER</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_in:
+ * @object: a #GObject
+ * @inarg: (in) (transfer none): This is an argument test
+ *
+ * This is a test for in arguments
+ *
+ * Returns: an int
+ */</output>
 </test>
 
 <test>
@@ -136,6 +153,11 @@ known by GObject as it's only marked as G_TYPE_POINTER</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_transfer_floating:
+ *
+ * Returns: (transfer floating): A floating object
+ */</output>
 </test>
 
 <test>
@@ -164,6 +186,12 @@ known by GObject as it's only marked as G_TYPE_POINTER</description>
 without....</description>
     </docblock>
   </parser>
+  <output>/**
+ * FsSession:codecs-without-config: (transfer full)
+ *
+ * This is the same list of codecs as #FsSession:codecs
+ * without....
+ */</output>
 </test>
 
 <test>
@@ -202,6 +230,12 @@ without....</description>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * FsSession:codecs-without-config: (transfer full)
+ *
+ * This is the same list of codecs as #FsSession:codecs
+ * without....
+ */</output>
 </test>
 
 <test>
@@ -240,6 +274,12 @@ without....</description>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * FsSession:codecs-without-config: (transfer full)
+ *
+ * This is the same list of codecs as #FsSession:codecs
+ * without....
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_type.xml 
b/tests/scanner/annotationparser/gi/annotation_type.xml
index f2e35d4..c3d6351 100644
--- a/tests/scanner/annotationparser/gi/annotation_type.xml
+++ b/tests/scanner/annotationparser/gi/annotation_type.xml
@@ -56,6 +56,14 @@
 known by GObject as it's only marked as G_TYPE_POINTER</description>
     </docblock>
   </parser>
+  <output>/**
+ * AnnotationObject::list-signal:
+ * @annotation: the annotation object
+ * @list: (type GLib.List) (element-type utf8) (transfer container): a list of strings
+ *
+ * This is a signal which takes a list of strings, but it's not
+ * known by GObject as it's only marked as G_TYPE_POINTER
+ */</output>
 </test>
 
 <test>
@@ -87,6 +95,9 @@ known by GObject as it's only marked as G_TYPE_POINTER</description>
       </identifier>
     </docblock>
   </parser>
+  <output>/**
+ * AnnotationObject:hash-table: (type GLib.HashTable(utf8,gint8)) (transfer container)
+ */</output>
 </test>
 
 <test>
@@ -121,6 +132,9 @@ known by GObject as it's only marked as G_TYPE_POINTER</description>
       </identifier>
     </docblock>
   </parser>
+  <output>/**
+ * AnnotationObject:hash-table: (type GLib.HashTable(utf8,gint8)) (transfer container)
+ */</output>
 </test>
 
 <test>
@@ -157,6 +171,11 @@ known by GObject as it's only marked as G_TYPE_POINTER</description>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestObj:hash-table: (type GLib.HashTable(utf8,gint8))
+ *
+ * Test.
+ */</output>
 </test>
 
 <test>
@@ -193,6 +212,11 @@ known by GObject as it's only marked as G_TYPE_POINTER</description>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestObj:hash-table: (type GLib.HashTable(utf8,gint8))
+ *
+ * Test.
+ */</output>
 </test>
 
 <test>
@@ -229,6 +253,11 @@ known by GObject as it's only marked as G_TYPE_POINTER</description>
    ^]]></message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestObj:hash-table: (type GLib.HashTable(utf8,gint8))
+ *
+ * Test.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_unref_func.xml 
b/tests/scanner/annotationparser/gi/annotation_unref_func.xml
index a8a911c..59f3f8d 100644
--- a/tests/scanner/annotationparser/gi/annotation_unref_func.xml
+++ b/tests/scanner/annotationparser/gi/annotation_unref_func.xml
@@ -26,6 +26,11 @@
       <description>This object tests regressions...</description>
     </docblock>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (unref-func regress_test_fundamental_object_unref)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -62,6 +67,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (unref-func regress_test_fundamental_object_unref)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 <test>
@@ -98,6 +108,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * RegressTestFundamentalObject: (unref-func regress_test_fundamental_object_unref)
+ *
+ * This object tests regressions...
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_value.xml 
b/tests/scanner/annotationparser/gi/annotation_value.xml
index 06f2bf2..7d72ef7 100644
--- a/tests/scanner/annotationparser/gi/annotation_value.xml
+++ b/tests/scanner/annotationparser/gi/annotation_value.xml
@@ -26,6 +26,11 @@
       <description>Constant to define a calculated large value</description>
     </docblock>
   </parser>
+  <output>/**
+ * ANNOTATION_CALCULATED_LARGE: (value 10000000000UL)
+ *
+ * Constant to define a calculated large value
+ */</output>
 </test>
 
 <test>
@@ -62,6 +67,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * ANNOTATION_CALCULATED_LARGE: (value 10000000000UL)
+ *
+ * Constant to define a calculated large value
+ */</output>
 </test>
 
 <test>
@@ -98,6 +108,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * ANNOTATION_CALCULATED_LARGE: (value 10000000000UL)
+ *
+ * Constant to define a calculated large value
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotation_virtual.xml 
b/tests/scanner/annotationparser/gi/annotation_virtual.xml
index 7439a69..3321eea 100644
--- a/tests/scanner/annotationparser/gi/annotation_virtual.xml
+++ b/tests/scanner/annotationparser/gi/annotation_virtual.xml
@@ -43,6 +43,14 @@
       <description>Read some stuff.</description>
     </docblock>
   </parser>
+  <output>/**
+ * foo_object_read: (virtual read_fn)
+ * @object: obj
+ * @offset: offset
+ * @length: length
+ *
+ * Read some stuff.
+ */</output>
 </test>
 
 <test>
@@ -96,6 +104,14 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * foo_object_read: (virtual read_fn)
+ * @object: obj
+ * @offset: offset
+ * @length: length
+ *
+ * Read some stuff.
+ */</output>
 </test>
 
 <test>
@@ -132,6 +148,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * foo_object_read: (virtual read_fn)
+ *
+ * Read some stuff.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/annotations.xml 
b/tests/scanner/annotationparser/gi/annotations.xml
index 0134abc..a7ca8e7 100644
--- a/tests/scanner/annotationparser/gi/annotations.xml
+++ b/tests/scanner/annotationparser/gi/annotations.xml
@@ -72,6 +72,12 @@
       <message>3: Warning: Test: unknown annotation: invalid-annotation-option</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test: (hello) (world)
+ * @param: (invalid-annotation-option): sizeof (x) == 1
+ *
+ * Test unknown annotations without options.
+ */</output>
 </test>
 
 <test>
@@ -126,6 +132,12 @@
       <description>Oops.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotationtest:
+ * @object: some data (foo bar)
+ *
+ * Oops.
+ */</output>
 </test>
 
 <test>
@@ -147,6 +159,11 @@
                     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test:
+ *
+ * Oops.
+ */</output>
 </test>
 
 <test>
@@ -175,6 +192,11 @@
       <message>2: Warning: Test: unknown annotation: world</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test: (hello) (world)
+ *
+ * Test unknown annotations without options.
+ */</output>
 </test>
 
 <test>
@@ -213,6 +235,11 @@
       <message>2: Warning: Test: unknown annotation: world</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test: (hello x=y    z) (world something else)
+ *
+ * Test unknown annotations with options.
+ */</output>
 </test>
 
 <test>
@@ -256,6 +283,12 @@
       <description>Test multiple identical option names.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_test:
+ * @test: (element-type gint gint) (transfer none):
+ *
+ * Test multiple identical option names.
+ */</output>
 </test>
 
 <test>
@@ -295,6 +328,11 @@
       <description>Test nested parentheses.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_test: (type GLib.HashTable(utf8,gint8)) (attributes x=1 y=2)
+ *
+ * Test nested parentheses.
+ */</output>
 </test>
 
 <test>
@@ -334,6 +372,11 @@
       <description>Test nested parentheses.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_test: (type GLib.HashTable(utf8,GLib.HashTable(utf8,gint8))) (attributes x=1 y=2)
+ *
+ * Test nested parentheses.
+ */</output>
 </test>
 
 <test>
@@ -373,6 +416,11 @@
       <description>Test deprecated angled brackets.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_test: (type GLib.HashTable(utf8,GLib.HashTable(utf8,gint8))) (attributes x=1 y=2)
+ *
+ * Test deprecated angled brackets.
+ */</output>
 </test>
 
 <test>
@@ -394,6 +442,11 @@
                      ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test:
+ *
+ * Test too many '('.
+ */</output>
 </test>
 
 <test>
@@ -430,6 +483,11 @@
                      ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test:
+ *
+ * Closing should not follow an opening parentheses.
+ */</output>
 </test>
 
 <test>
@@ -451,6 +509,11 @@
                            ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test:
+ *
+ * Closing should not follow an opening parentheses.
+ */</output>
 </test>
 
 <test>
@@ -472,6 +535,11 @@
                           ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test:
+ *
+ * Test too many ')'.
+ */</output>
 </test>
 
 <test>
@@ -499,6 +567,12 @@
                                          ^]]></message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test:
+ * @test:
+ *
+ * Test missing '('.
+ */</output>
 </test>
 
 <test>
@@ -520,6 +594,11 @@
                                              ^</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test:
+ *
+ * Test missing ')'.
+ */</output>
 </test>
 
 <test>
@@ -547,6 +626,12 @@
                                                               ^]]></message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_test:
+ * @test:
+ *
+ * Test missing ')'.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/identifier.xml 
b/tests/scanner/annotationparser/gi/identifier.xml
index dd8ee17..eb09030 100644
--- a/tests/scanner/annotationparser/gi/identifier.xml
+++ b/tests/scanner/annotationparser/gi/identifier.xml
@@ -25,6 +25,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * SECTION:test_invalid_section_identifier
+ *
+ * Above identifier is not on the first line.
+ */</output>
 </test>
 
 <test>
@@ -49,6 +54,9 @@
 ^</message>
     </messages>
   </parser>
+  <output>/**
+ * SECTION:meepapp
+ */</output>
 </test>
 
 <test>
@@ -77,6 +85,13 @@
 The application class handles ...</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:meepapp
+ * @short_description: the application class
+ *
+ * SECTION:meepapp2
+ * The application class handles ...
+ */</output>
 </test>
 
 <test>
diff --git a/tests/scanner/annotationparser/gi/identifier_section.xml 
b/tests/scanner/annotationparser/gi/identifier_section.xml
index b75e2dd..fad2b2e 100644
--- a/tests/scanner/annotationparser/gi/identifier_section.xml
+++ b/tests/scanner/annotationparser/gi/identifier_section.xml
@@ -55,6 +55,18 @@
       <description>The application class handles ...</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:meepapp
+ * @short_description: the application class
+ * @title: Meep application
+ * @section_id:
+ * @see_also: #MeepSettings
+ * @stability: Stable
+ * @include: meep/app.h
+ * @image: application.png
+ *
+ * The application class handles ...
+ */</output>
 </test>
 
 <test>
@@ -116,6 +128,18 @@
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * SECTION:meepapp
+ * @short_description: the application class
+ * @title: Meep application
+ * @section_id:
+ * @see_also: #MeepSettings
+ * @stability: Stable
+ * @include: meep/app.h
+ * @image: application.png
+ *
+ * The application class handles ...
+ */</output>
 </test>
 
 <test>
@@ -176,6 +200,18 @@
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * SECTION:meepapp
+ * @short_description: the application class
+ * @title: Meep application
+ * @section_id:
+ * @see_also: #MeepSettings
+ * @stability: Stable
+ * @include: meep/app.h
+ * @image: application.png
+ *
+ * The application class handles ...
+ */</output>
 </test>
 
 <test>
@@ -237,6 +273,18 @@
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * SECTION:meepapp
+ * @short_description: the application class
+ * @title: Meep application
+ * @section_id:
+ * @see_also: #MeepSettings
+ * @stability: Stable
+ * @include: meep/app.h
+ * @image: application.png
+ *
+ * The application class handles ...
+ */</output>
 </test>
 
 <test>
@@ -270,6 +318,15 @@ As described in http://bugzilla.gnome.org/show_bug.cgi?id=457077 it
 returns nothing.</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:tester
+ * @short_description: module for gtk-doc unit test
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ *
+ * As described in http://bugzilla.gnome.org/show_bug.cgi?id=457077 it
+ * returns nothing.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/identifier_symbol.xml 
b/tests/scanner/annotationparser/gi/identifier_symbol.xml
index 2f27975..522f1fa 100644
--- a/tests/scanner/annotationparser/gi/identifier_symbol.xml
+++ b/tests/scanner/annotationparser/gi/identifier_symbol.xml
@@ -16,6 +16,11 @@
       <description>test_symbol does something nifty.</description>
     </docblock>
   </parser>
+  <output>/**
+ * test_symbol:
+ *
+ * test_symbol does something nifty.
+ */</output>
 </test>
 
 <test>
@@ -32,6 +37,11 @@
       <description>Unnecessary colon.</description>
     </docblock>
   </parser>
+  <output>/**
+ * test_symbol_unnecessary_colon:
+ *
+ * Unnecessary colon.
+ */</output>
 </test>
 
 <test>
@@ -53,6 +63,11 @@
       <description>test_annotated_symbol does something nifty.</description>
     </docblock>
   </parser>
+  <output>/**
+ * test_annotated_symbol: (skip)
+ *
+ * test_annotated_symbol does something nifty.
+ */</output>
 </test>
 
 <test>
@@ -79,6 +94,11 @@
                              ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_symbol_missing_colon: (skip)
+ *
+ * Missing colon will result in a warning.
+ */</output>
 </test>
 
 <test>
@@ -100,6 +120,11 @@
       <description>Malformed symbol identifier.</description>
     </docblock>
   </parser>
+  <output>/**
+ * test_malformed_symbol: (skip)
+ *
+ * Malformed symbol identifier.
+ */</output>
 </test>
 
 <test>
@@ -116,6 +141,11 @@
       <description>Some property.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkWidget:test_property:
+ *
+ * Some property.
+ */</output>
 </test>
 
 <test>
@@ -132,6 +162,11 @@
       <description>Unnecessary colon.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkWidget:test_property_unnecessary_colon:
+ *
+ * Unnecessary colon.
+ */</output>
 </test>
 
 <test>
@@ -153,6 +188,11 @@
       <description>Some annotated property.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkWidget:test_annotated_property: (skip)
+ *
+ * Some annotated property.
+ */</output>
 </test>
 
 <test>
@@ -179,6 +219,11 @@
                                          ^</message>
     </messages>
   </parser>
+  <output>/**
+ * GtkWidget:test_property_missing_colon: (skip)
+ *
+ * Missing colon will result in a warning.
+ */</output>
 </test>
 
 <test>
@@ -200,6 +245,11 @@
       <description>Malformed property identifier.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkWidget:test_malformed_property: (skip)
+ *
+ * Malformed property identifier.
+ */</output>
 </test>
 
 <test>
@@ -216,6 +266,11 @@
       <description>Some signal.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkWidget::test_signal:
+ *
+ * Some signal.
+ */</output>
 </test>
 
 <test>
@@ -232,6 +287,11 @@
       <description>Unnecessary colon.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkWidget::test_signal_unnecessary_colon:
+ *
+ * Unnecessary colon.
+ */</output>
 </test>
 
 <test>
@@ -253,6 +313,11 @@
       <description>Some annotated signal.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkWidget::test_annotated_signal: (skip)
+ *
+ * Some annotated signal.
+ */</output>
 </test>
 
 <test>
@@ -279,6 +344,11 @@
                                         ^</message>
     </messages>
   </parser>
+  <output>/**
+ * GtkWidget::test_signal_missing_colon: (skip)
+ *
+ * Missing colon will result in a warning.
+ */</output>
 </test>
 
 <test>
@@ -300,6 +370,11 @@
       <description>Malformed signal identifier.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkWidget::test_malformed_signal: (skip)
+ *
+ * Malformed signal identifier.
+ */</output>
 </test>
 
 <test>
@@ -348,6 +423,13 @@ Annotations spanning multiple lines are not valid</description>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiline_annotations_on_identifier: (skip)
+ * @param1: (allow-none) (transfer full): first parameter
+ *
+ * (foreign)
+ * Annotations spanning multiple lines are not valid
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/parameter.xml b/tests/scanner/annotationparser/gi/parameter.xml
index fcf9ee4..43f97b3 100644
--- a/tests/scanner/annotationparser/gi/parameter.xml
+++ b/tests/scanner/annotationparser/gi/parameter.xml
@@ -33,6 +33,12 @@
                         ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_parameter_missing_colon:
+ * @param1: (allow-none): first parameter
+ *
+ * Forgotten colon above will result in a warning.
+ */</output>
 </test>
 
 <test>
@@ -72,6 +78,14 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_unexpected_parameter:
+ * @param1: first parameter
+ *
+ * Parameters should go before the comment block description.
+ *
+ * Returns: something
+ */</output>
 </test>
 
 <test>
@@ -98,6 +112,10 @@
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiple_parameters:
+ * @param1: first parameter again
+ */</output>
 </test>
 
 <test>
@@ -133,6 +151,13 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiline_annotations_on_parameter:
+ * @param1: (allow-none):
+ * (transfer full): first parameter
+ *
+ * Annotations spanning multiple lines are not valid
+ */</output>
 </test>
 
 <test>
@@ -163,6 +188,13 @@
       <description>Annotations spanning multiple lines are not valid</description>
     </docblock>
   </parser>
+  <output>/**
+ * test_multiline_annotations_on_parameter:
+ * @param1: (allow-none): first parameter having a second line which looks
+ * (like an annotation), but isn't. This should not result in a warning.
+ *
+ * Annotations spanning multiple lines are not valid
+ */</output>
 </test>
 
 <test>
@@ -199,6 +231,14 @@
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * anjuta_async_notify_get_error:
+ * @self: An #AnjutaAsyncNotify object
+ * @error: Return location for the error set by the called interface to which
+ *                 this object was passed. If no error is set, @error is set to NULL.
+ *
+ * Gets the error set on @self.
+ */</output>
 </test>
 
 <test>
@@ -253,6 +293,24 @@ after #GtkPrintOperation::done was emitted.</description>
       </tags>
     </docblock>
   </parser>
+  <output>  /**
+   * GtkPrintOperation::done:
+   * @operation: the #GtkPrintOperation on which the signal was emitted
+   * @result: the result of the print operation
+   *
+   * Emitted when the print operation run has finished doing
+   * everything required for printing.
+   *
+   * @result gives you information about what happened during the run.
+   * If @result is %GTK_PRINT_OPERATION_RESULT_ERROR then you can call
+   * gtk_print_operation_get_error() for more information.
+   *
+   * If you enabled print status tracking then
+   * gtk_print_operation_is_finished() may still return %FALSE
+   * after #GtkPrintOperation::done was emitted.
+   *
+   * Since: 2.10
+   */</output>
 </test>
 
 <test>
diff --git a/tests/scanner/annotationparser/gi/parameter_varargs.xml 
b/tests/scanner/annotationparser/gi/parameter_varargs.xml
index 0952ee9..b22906d 100644
--- a/tests/scanner/annotationparser/gi/parameter_varargs.xml
+++ b/tests/scanner/annotationparser/gi/parameter_varargs.xml
@@ -61,6 +61,22 @@ other declarations (which may be documented elsewhere).</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * function_name:
+ * @par1: description of parameter 1. These can extend over more than
+ * one line.
+ * @par2: description of parameter 2
+ * @...: a %NULL-terminated list of bars
+ *
+ * The function description goes here. You can use @par1 to refer to parameters
+ * so that they are highlighted in the output. You can also use %constant
+ * for constants, function_name2() for functions and #GtkWidget for links to
+ * other declarations (which may be documented elsewhere).
+ *
+ * Returns: an integer.
+ * Since: 2.2
+ * Deprecated: 2.18: Use other_function() instead.
+ */</output>
 </test>
 
 <test>
@@ -104,6 +120,14 @@ name it is called in.</description>
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * DBG:
+ * @fmt: format string
+ * @...: list of arguments
+ *
+ * Simple macro around btd_debug() which also include the function
+ * name it is called in.
+ */</output>
 </test>
 
 <test>
@@ -173,6 +197,22 @@ other declarations (which may be documented elsewhere).</description>
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * function_name:
+ * @par1: description of parameter 1. These can extend over more than
+ * one line.
+ * @par2: description of parameter 2
+ * @...: a %NULL-terminated list of bars
+ *
+ * The function description goes here. You can use @par1 to refer to parameters
+ * so that they are highlighted in the output. You can also use %constant
+ * for constants, function_name2() for functions and #GtkWidget for links to
+ * other declarations (which may be documented elsewhere).
+ *
+ * Returns: an integer.
+ * Since: 2.2
+ * Deprecated: 2.18: Use other_function() instead.
+ */</output>
 </test>
 
 <test>
@@ -237,6 +277,22 @@ other declarations (which may be documented elsewhere).</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * function_name:
+ * @par1: description of parameter 1. These can extend over more than
+ * one line.
+ * @par2: description of parameter 2
+ * @varargs: a %NULL-terminated list of bars
+ *
+ * The function description goes here. You can use @par1 to refer to parameters
+ * so that they are highlighted in the output. You can also use %constant
+ * for constants, function_name2() for functions and #GtkWidget for links to
+ * other declarations (which may be documented elsewhere).
+ *
+ * Returns: an integer.
+ * Since: 2.2
+ * Deprecated: 2.18: Use other_function() instead.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/syntax.xml b/tests/scanner/annotationparser/gi/syntax.xml
index 2ea2c6f..b4eff5a 100644
--- a/tests/scanner/annotationparser/gi/syntax.xml
+++ b/tests/scanner/annotationparser/gi/syntax.xml
@@ -89,6 +89,9 @@ something */</input>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * Test:
+ */</output>
 </test>
 
 <test>
@@ -106,6 +109,9 @@ Test */
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * Test:
+ */</output>
 </test>
 
 <test>
@@ -127,6 +133,11 @@ something */
          ^</message>
     </messages>
   </parser>
+  <output>/**
+ * Test:
+ *
+ * something
+ */</output>
 </test>
 
 <test>
@@ -146,6 +157,11 @@ something */
          ^</message>
     </messages>
   </parser>
+  <output>/**
+ * Test:
+ *
+ * something
+ */</output>
 </test>
 
 <test>
@@ -165,6 +181,11 @@ something **/
          ^</message>
     </messages>
   </parser>
+  <output>/**
+ * Test:
+ *
+ * something
+ */</output>
 </test>
 
 <test>
@@ -192,6 +213,13 @@ something */ code goes here
          ^</message>
     </messages>
   </parser>
+  <output><![CDATA[code goes here
+/**
+ * Test:
+ *
+ * something
+ */
+ code goes here]]></output>
 </test>
 
 <test>
@@ -225,6 +253,12 @@ something */ code goes here
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * SECTION:meepapp
+ * @short_description: the application class
+ *
+ * The application class handles ...
+ */</output>
 </test>
 
 <test>
@@ -261,6 +295,13 @@ https://bugzilla.gnome.org/show_bug.cgi?id=673806</description>
 ^</message>
     </messages>
   </parser>
+  <output>/**
+ * regress_test_invalid_comment:
+ * @foo: a param
+ *
+ * comment having lines without ' * '
+ * https://bugzilla.gnome.org/show_bug.cgi?id=673806
+ */</output>
 </test>
 
 <test>
@@ -301,6 +342,18 @@ a *</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * atk_hyperlink_is_inline:
+ * @link_: an #AtkHyperlink
+ *
+ * Indicates whether the link currently displays some or all of its
+ *           content inline.  Ordinary HTML links will usually return
+ *           %FALSE, but an inline &lt;src&gt; HTML element will return
+ *           %TRUE.
+ * a *
+ *
+ * Returns: whether or not this link displays its content inline.
+ */</output>
 </test>
 
 <test>
@@ -336,6 +389,18 @@ and gtk_tooltip_set_icon().</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * gtk_tooltip_set_custom:
+ *
+ * Replaces the widget packed into the tooltip with
+ * @custom_widget. @custom_widget does not get destroyed when the tooltip goes
+ * away.
+ * By default a box with a #GtkImage and #GtkLabel is embedded in
+ * the tooltip, which can be configured using gtk_tooltip_set_markup()
+ * and gtk_tooltip_set_icon().
+ *
+ * Since: 2.12
+ */</output>
 </test>
 
 <test>
@@ -363,6 +428,12 @@ and gtk_tooltip_set_icon().</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * clutter_text_coords_to_position:
+ * @self: a #ClutterText
+ *
+ * Returns: the position of the character
+ */</output>
 </test>
 
 <test>
@@ -383,6 +454,11 @@ and gtk_tooltip_set_icon().</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * clutter_text_coords_to_position:
+ *
+ * Returns: the position of the character
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/syntax_indentation.xml 
b/tests/scanner/annotationparser/gi/syntax_indentation.xml
index 21fd1d8..1b8c632 100644
--- a/tests/scanner/annotationparser/gi/syntax_indentation.xml
+++ b/tests/scanner/annotationparser/gi/syntax_indentation.xml
@@ -16,6 +16,11 @@
       <description>Describe section here</description>
     </docblock>
   </parser>
+  <output>  /**
+   * SECTION:test
+   *
+   * Describe section here
+   */</output>
 </test>
 
 <test>
@@ -32,6 +37,11 @@
       <description>Describe section here</description>
     </docblock>
   </parser>
+  <output>     /**
+        * SECTION:test
+        *
+        * Describe section here
+        */</output>
 </test>
 
 <test>
@@ -48,6 +58,11 @@
       <description>Describe section here</description>
     </docblock>
   </parser>
+  <output>     /**
+        * SECTION:test
+        *
+        * Describe section here
+        */</output>
 </test>
 
 <test>
@@ -64,6 +79,11 @@
       <description>Describe section here</description>
     </docblock>
   </parser>
+  <output indent="false">/**
+ * SECTION:test
+ *
+ * Describe section here
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/syntax_multiline_annotations.xml 
b/tests/scanner/annotationparser/gi/syntax_multiline_annotations.xml
index 0f5efa1..4aa92e4 100644
--- a/tests/scanner/annotationparser/gi/syntax_multiline_annotations.xml
+++ b/tests/scanner/annotationparser/gi/syntax_multiline_annotations.xml
@@ -32,6 +32,12 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * regress_forced_method: (skip)
+ * @obj: A #RegressTestObj
+ *
+ * (method)
+ */</output>
 </test>
 
 <test>
@@ -64,6 +70,12 @@
        ^</message>
     </messages>
   </parser>
+  <output>/**
+ * regress_forced_method: (skip)
+ * @obj: A #RegressTestObj
+ *
+ * (method)
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/syntax_nested_tags.xml 
b/tests/scanner/annotationparser/gi/syntax_nested_tags.xml
index d5a3042..d1dd54f 100644
--- a/tests/scanner/annotationparser/gi/syntax_nested_tags.xml
+++ b/tests/scanner/annotationparser/gi/syntax_nested_tags.xml
@@ -45,6 +45,19 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * GApplicationFlags:
+ * @G_APPLICATION_NON_UNIQUE: Make no attempts to do any of the typical
+ *     single-instance application negotiation, even if the application
+ *     ID is given.  The application neither attempts to become the
+ *     owner of the application ID nor does it check if an existing
+ *     owner already exists.  Everything occurs in the local process.
+ *     Since: 2.30.
+ *
+ * Flags used to define the behaviour of a #GApplication.
+ *
+ * Since: 2.28
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml 
b/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml
index 7e88bf7..77cabf0 100644
--- a/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml
+++ b/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml
@@ -24,6 +24,13 @@
 So this is considered a new paragraph.</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:test
+ *
+ * The following line is ' *' (blank-asterisk).
+ *
+ * So this is considered a new paragraph.
+ */</output>
 </test>
 
 <test>
@@ -53,6 +60,13 @@ So this is considered a new paragraph.</description>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * SECTION:test
+ *
+ * The following line is ' *' (blank-asterisk).
+ *
+ * So this is considered a new paragraph.
+ */</output>
 </test>
 
 <test>
@@ -76,6 +90,13 @@ So this is considered a new paragraph.</description>
 So this is considered a new paragraph.</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:test
+ *
+ * The following line is ' * ' (blank-asterisk-blank).
+ *
+ * So this is considered a new paragraph.
+ */</output>
 </test>
 
 <test>
@@ -104,6 +125,13 @@ So this is considered a new paragraph.</description>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * SECTION:test
+ *
+ * The following line is ' * ' (blank-asterisk-blank).
+ *
+ * So this is considered a new paragraph.
+ */</output>
 </test>
 
 <test>
@@ -129,6 +157,13 @@ So this is considered a new paragraph.</description>
 So this is preceded by an empty line and is not considered a new paragraph.</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:test
+ *
+ * The following line is (blank-asterisk-blank-blank).
+ *  
+ * So this is preceded by an empty line and is not considered a new paragraph.
+ */</output>
 </test>
 
 <test>
@@ -159,6 +194,13 @@ So this is preceded by an empty line and is not considered a new paragraph.</des
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * SECTION:test
+ *
+ * The following line is (blank-asterisk-blank-blank).
+ *  
+ * So this is preceded by an empty line and is not considered a new paragraph.
+ */</output>
 </test>
 
 <test>
@@ -212,6 +254,27 @@ print_attributes (GIBaseInfo *info)
 </example>]]></description>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * SECTION:test
+ *
+ * <example>
+ * <title>Iterating over attributes</title>
+ * <programlisting>
+ * void
+ * print_attributes (GIBaseInfo *info)
+ * {
+ *   GIAttributeIter iter = { 0, };
+ *   char *name;
+ *   char *value;
+ *  
+ *   while (g_base_info_iterate_attributes (info, &iter, &name, &value))
+ *     {
+ *       g_print ("attribute name: %s value: %s", name, value);
+ *     }
+ * }
+ * </programlisting>
+ * </example>
+ */]]></output>
 </test>
 
 <test>
@@ -270,6 +333,27 @@ print_attributes (GIBaseInfo *info)
    ^]]></message>
     </messages>
   </parser>
+  <output><![CDATA[/**
+ * SECTION:test
+ *
+ * <example>
+ * <title>Iterating over attributes</title>
+ * <programlisting>
+ * void
+ * print_attributes (GIBaseInfo *info)
+ * {
+ *   GIAttributeIter iter = { 0, };
+ *   char *name;
+ *   char *value;
+ *  
+ *   while (g_base_info_iterate_attributes (info, &iter, &name, &value))
+ *     {
+ *       g_print ("attribute name: %s value: %s", name, value);
+ *     }
+ * }
+ * </programlisting>
+ * </example>
+ */]]></output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/syntax_whitespace.xml 
b/tests/scanner/annotationparser/gi/syntax_whitespace.xml
index e66836c..c7934da 100644
--- a/tests/scanner/annotationparser/gi/syntax_whitespace.xml
+++ b/tests/scanner/annotationparser/gi/syntax_whitespace.xml
@@ -57,6 +57,19 @@ Test overriding via the "Rename To" annotation.</description>
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * whitespace_test:
+ * @object: (skip):
+ * @func: The callback
+ *
+ * A #AnnotationObject
+ *        
+ *        
+ *
+ * Test overriding via the "Rename To" annotation.
+ *
+ * Returns: nothing
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/tag.xml b/tests/scanner/annotationparser/gi/tag.xml
index c91ec0f..8480d4b 100644
--- a/tests/scanner/annotationparser/gi/tag.xml
+++ b/tests/scanner/annotationparser/gi/tag.xml
@@ -34,6 +34,13 @@
                         ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_tag_missing_colon:
+ *
+ * Forgotten colon below will result in a warning.
+ *
+ * Returns: (allow-none): return value
+ */</output>
 </test>
 
 <test>
@@ -77,6 +84,17 @@ the "Returns:"" tag description field.</description>
     ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_unexpected_tag:
+ * @param1: first parameter
+ * does something
+ *
+ * Returns: something
+ * returning something
+ *
+ * Probably intended as the comment block description part but in reality belongs to
+ * the "Returns:"" tag description field.
+ */</output>
 </test>
 
 <test>
@@ -181,6 +199,14 @@ Moo: anything</description>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiline_annotations_on_tag:
+ *
+ * Annotations spanning multiple lines are not valid
+ *
+ * Returns: (allow-none):
+ * (transfer full): something
+ */</output>
 </test>
 
 <test>
@@ -212,6 +238,14 @@ Moo: anything</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * test_multiline_annotations_on_tag:
+ *
+ * Annotations spanning multiple lines are not valid
+ *
+ * Returns: (allow-none): Returns tag having a second line which looks
+ * (like an annotation), but isn't. This should not result in a warning.
+ */</output>
 </test>
 
 <test>
@@ -273,6 +307,18 @@ the axes that @device currently has.</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * gdk_device_list_axes:
+ * @device: a pointer #GdkDevice
+ *
+ * Returns a #GList of #GdkAtom<!-- -->s, containing the labels for
+ * the axes that @device currently has.
+ *
+ * Returns: (transfer container) (element-type GdkAtom):
+ *     A #GList of #GdkAtom<!-- -->s, free
+ *     with g_list_free().
+ * Since: 3.0
+ */</output>
 </test>
 
 <test>
@@ -336,6 +382,20 @@ dynamically assigned payload type.</description>
      ^</message>
     </messages>
   </parser>
+  <output>  /**
+   * FsSession:codec-preferences: (type GLib.List(FsCodec)) (transfer full)
+   *
+   * This is the current preferences list for the local codecs. It is
+   * set by the user to specify the codec options and priorities. The user may
+   * change its value with fs_session_set_codec_preferences() at any time
+   * during a session. It is a #GList of #FsCodec.
+   * The user must free this codec list using fs_codec_list_destroy() when done.
+   *
+   * The payload type may be a valid dynamic PT (96-127), %FS_CODEC_ID_DISABLE
+   * or %FS_CODEC_ID_ANY. If the encoding name is "reserve-pt", then the
+   * payload type of the codec will be "reserved" and not be used by any
+   * dynamically assigned payload type.
+   */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/tag_deprecated.xml 
b/tests/scanner/annotationparser/gi/tag_deprecated.xml
index dcbb219..f1e8ca6 100644
--- a/tests/scanner/annotationparser/gi/tag_deprecated.xml
+++ b/tests/scanner/annotationparser/gi/tag_deprecated.xml
@@ -22,6 +22,11 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_versioned:
+ *
+ * Deprecated: 0.6: Use something else instead
+ */</output>
 </test>
 
 <test>
@@ -43,6 +48,11 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_versioned:
+ *
+ * Deprecated: 0.6
+ */</output>
 </test>
 
 <test>
@@ -70,6 +80,13 @@
       <message>6: Error: Test: annotations not supported for tag "Deprecated:".</message>
     </messages>
   </parser>
+  <output>/**
+ * test_tag_not_annotatable:
+ *
+ * Tags (except Returns:) don't have annotations
+ *
+ * Deprecated: 2.24
+ */</output>
 </test>
 
 <test>
@@ -100,6 +117,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiple_tags:
+ *
+ * Deprecated: 2.0
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/tag_description.xml 
b/tests/scanner/annotationparser/gi/tag_description.xml
index 99245c8..3dff7f3 100644
--- a/tests/scanner/annotationparser/gi/tag_description.xml
+++ b/tests/scanner/annotationparser/gi/tag_description.xml
@@ -23,6 +23,12 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * shiny_function:
+ *
+ * This is a callback with a 'closure' argument that is not named
+ * 'user_data' and hence has to be annotated.
+ */</output>
 </test>
 
 <test>
@@ -45,6 +51,12 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * shiny_function:
+ *
+ * This is a callback with a 'closure' argument that is not named
+ * 'user_data' and hence has to be annotated.
+ */</output>
 </test>
 
 <test>
@@ -72,6 +84,14 @@ This is a callback with a 'closure' argument that is not named
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * shiny_function:
+ *
+ * Some description here, but also below...
+ *
+ * This is a callback with a 'closure' argument that is not named
+ * 'user_data' and hence has to be annotated.
+ */</output>
 </test>
 
 <test>
@@ -99,6 +119,14 @@ This is a callback with a 'closure' argument that is not named
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * shiny_function:
+ *
+ * This is a callback with a 'closure' argument that is not named
+ * 'user_data' and hence has to be annotated.
+ *
+ *   etc...
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/tag_returns.xml 
b/tests/scanner/annotationparser/gi/tag_returns.xml
index 8396320..8ccfaa6 100644
--- a/tests/scanner/annotationparser/gi/tag_returns.xml
+++ b/tests/scanner/annotationparser/gi/tag_returns.xml
@@ -29,6 +29,13 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_string_out:
+ *
+ * Test returning a string as an out parameter
+ *
+ * Returns: (allow-none): some boolean
+ */</output>
 </test>
 
 <test>
@@ -95,6 +102,14 @@ Tags should go after the comment block description</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * test_unexpected_tag:
+ * @param1: first parameter
+ *
+ * Returns: something
+ *
+ * Tags should go after the comment block description
+ */</output>
 </test>
 
 <test>
@@ -127,6 +142,13 @@ Tags should go after the comment block description</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_string_out:
+ *
+ * Test returning a string as an out parameter
+ *
+ * Returns: (allow-none): some boolean
+ */</output>
 </test>
 
 <test>
@@ -158,6 +180,13 @@ Tags should go after the comment block description</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_object_string_out:
+ *
+ * Test returning a string as an out parameter
+ *
+ * Returns: (allow-none): some boolean
+ */</output>
 </test>
 
 <test>
@@ -263,6 +292,14 @@ parameter is encountered.</description>
       <message>8: Error: Test: encountered multiple "Returns" parameters or tags for 
"test_multiple_returns_tag_and_parameter".</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiple_returns_tag_and_parameter:
+ *
+ * Multiple return value warnings are checked for when a returns
+ * parameter is encountered.
+ *
+ * Returns: something else
+ */</output>
 </test>
 
 <test>
@@ -296,6 +333,14 @@ parameter is encountered.</description>
       <message>8: Error: Test: encountered multiple return value parameters or tags for 
"test_multiple_returns_tag_and_parameter".</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiple_returns_tag_and_parameter:
+ *
+ * Multiple return value warnings are checked for when a returns
+ * parameter is encountered.
+ *
+ * Returns: something else
+ */</output>
 </test>
 
 <test>
@@ -329,6 +374,14 @@ parameter is encountered.</description>
       <message>8: Error: Test: encountered multiple return value parameters or tags for 
"test_multiple_returns_tag_and_parameter".</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiple_returns_tag_and_parameter:
+ *
+ * Multiple return value warnings are checked for when a returns
+ * parameter is encountered.
+ *
+ * Returns: something else
+ */</output>
 </test>
 
 <test>
@@ -362,6 +415,18 @@ not be used by applications under normal circumstances.]]></description>
       </tags>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * gtk_rc_get_im_module_path:
+ *
+ * Obtains the path in which to look for IM modules. See the documentation
+ * of the <link linkend="im-module-path"><envar>GTK_PATH</envar></link>
+ * environment variable for more details about looking up modules. This
+ * function is useful solely for utilities supplied with GTK+ and should
+ * not be used by applications under normal circumstances.
+ *
+ * Returns: a newly-allocated string containing the path in which to
+ *    look for IM modules.
+ */]]></output>
 </test>
 
 <test>
@@ -413,6 +478,17 @@ not be used by applications under normal circumstances.]]></description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * clutter_text_coords_to_position:
+ * @self: a #ClutterText
+ * @x: the X coordinate, relative to the actor
+ * @y: the Y coordinate, relative to the actor
+ *
+ * Retrieves the position of the character at the given coordinates.
+ *
+ * Returns: the position of the character
+ * Since: 1.10
+ */</output>
 </test>
 
 <test>
@@ -464,6 +540,17 @@ not be used by applications under normal circumstances.]]></description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * clutter_text_coords_to_position:
+ * @self: a #ClutterText
+ * @x: the X coordinate, relative to the actor
+ * @y: the Y coordinate, relative to the actor
+ *
+ * Retrieves the position of the character at the given coordinates.
+ *
+ * Returns: the position of the character
+ * Since: 1.10
+ */</output>
 </test>
 
 <test>
@@ -496,6 +583,13 @@ not be used by applications under normal circumstances.]]></description>
       <message>6: Warning: Test: unexpected annotation: out</message>
     </messages>
   </parser>
+  <output>/**
+ * annotation_object_string_out:
+ *
+ * Test returning a string as an out parameter
+ *
+ * Returns: (out): some boolean
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/tag_since.xml b/tests/scanner/annotationparser/gi/tag_since.xml
index e854545..06116aa 100644
--- a/tests/scanner/annotationparser/gi/tag_since.xml
+++ b/tests/scanner/annotationparser/gi/tag_since.xml
@@ -21,6 +21,11 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_versioned:
+ *
+ * Since: 0.6
+ */</output>
 </test>
 
 <test>
@@ -72,6 +77,11 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_versioned:
+ *
+ * Since: this function is available since version 0.6
+ */</output>
 </test>
 
 <test>
@@ -94,6 +104,11 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_versioned:
+ *
+ * Since: 0.6: this function is available since version 0.6
+ */</output>
 </test>
 
 <test>
@@ -121,6 +136,13 @@
       <message>6: Error: Test: annotations not supported for tag "Since:".</message>
     </messages>
   </parser>
+  <output>/**
+ * test_tag_not_annotatable:
+ *
+ * Tags (except Returns:) don't have annotations
+ *
+ * Since: 2.24
+ */</output>
 </test>
 
 <test>
@@ -154,6 +176,12 @@ tags is wrong...</description>
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiple_tags:
+ *
+ * Since: 2.0: one of these "Since:"
+ * tags is wrong...
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gi/tag_stability.xml 
b/tests/scanner/annotationparser/gi/tag_stability.xml
index a82d19c..25c907f 100644
--- a/tests/scanner/annotationparser/gi/tag_stability.xml
+++ b/tests/scanner/annotationparser/gi/tag_stability.xml
@@ -21,6 +21,11 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_versioned:
+ *
+ * Stability: Stable
+ */</output>
 </test>
 
 <test>
@@ -42,6 +47,11 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_versioned:
+ *
+ * Stability: Unstable
+ */</output>
 </test>
 
 <test>
@@ -63,6 +73,11 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_versioned:
+ *
+ * Stability: Private
+ */</output>
 </test>
 
 <test>
@@ -84,6 +99,11 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_versioned:
+ *
+ * Stability: behavior tends to vary depending on the phase of the moon.
+ */</output>
 </test>
 
 <test>
@@ -111,6 +131,13 @@
       <message>6: Error: Test: annotations not supported for tag "Stability:".</message>
     </messages>
   </parser>
+  <output>/**
+ * test_tag_not_annotatable:
+ *
+ * Tags (except Returns:) don't have annotations
+ *
+ * Stability: Private
+ */</output>
 </test>
 
 <test>
@@ -141,6 +168,11 @@
    ^</message>
     </messages>
   </parser>
+  <output>/**
+ * test_multiple_tags:
+ *
+ * Stability: Private
+ */</output>
 </test>
 
 <test>
@@ -168,6 +200,12 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * test_stability_description:
+ *
+ * Stability: Unstable: maybe one day this will work
+ *                      correctly...
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/annotations/tester.c.xml 
b/tests/scanner/annotationparser/gtkdoc/annotations/tester.c.xml
index 9fda10b..bf94edb 100644
--- a/tests/scanner/annotationparser/gtkdoc/annotations/tester.c.xml
+++ b/tests/scanner/annotationparser/gtkdoc/annotations/tester.c.xml
@@ -23,6 +23,12 @@
       <description>This file contains non-sense code for the sole purpose of testing the docs.</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:tester
+ * @short_description: module for gtk-doc unit test
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ */</output>
 </test>
 
 <test>
@@ -67,6 +73,14 @@
       <description>Document parameter relation for array length.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_array_length:
+ * @list: a #GtkListStore
+ * @n_columns: number of columns
+ * @types: (array length=n_columns): list of types
+ *
+ * Document parameter relation for array length.
+ */</output>
 </test>
 
 <test>
@@ -125,6 +139,17 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_nullable:
+ * @uri: a uri
+ * @label: (allow-none): an optional string, which is used in ways too
+ *  complicated to describe in a single line, making it necessary to wrap it
+ *
+ * Document optional parameters.
+ *
+ * Returns: (transfer full) (allow-none): Returns stuff which you have to
+ *  free after use, whose description is also rather long
+ */</output>
 </test>
 
 <test>
@@ -166,6 +191,14 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_elementtype:
+ * @list: (element-type GObject): list of #GObject instances to search
+ *
+ * Document optional parameters.
+ *
+ * Returns: %TRUE for success
+ */</output>
 </test>
 
 <test>
@@ -215,6 +248,14 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_elementtype_transfer:
+ * @list: (element-type utf8) (transfer full): list of #GObject instances to search
+ *
+ * Document optional parameters.
+ *
+ * Returns: %TRUE for success
+ */</output>
 </test>
 
 <test>
@@ -249,6 +290,13 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_elementtype_returns:
+ *
+ * Document optional parameters.
+ *
+ * Returns: (element-type GObject): A list of #GObject instances.
+ */</output>
 </test>
 
 <test>
@@ -293,6 +341,14 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_outparams:
+ * @list: (out) (transfer none): a pointer to take a list
+ *
+ * Document optional parameters.
+ *
+ * Returns: %TRUE for success
+ */</output>
 </test>
 
 <test>
@@ -321,6 +377,12 @@
       <description>Documentation for this function.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_skip: (skip)
+ * @list: a pointer to take a list
+ *
+ * Documentation for this function.
+ */</output>
 </test>
 
 <test>
@@ -359,6 +421,13 @@
       <description>Documentation for this function.</description>
     </docblock>
   </parser>
+  <output>/**
+ * annotation_scope:
+ * @callback: (scope async): a callback
+ * @user_data: data to pass to callback
+ *
+ * Documentation for this function.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/annotations/tester.h.xml 
b/tests/scanner/annotationparser/gtkdoc/annotations/tester.h.xml
index 6d00aa3..0917cd9 100644
--- a/tests/scanner/annotationparser/gtkdoc/annotations/tester.h.xml
+++ b/tests/scanner/annotationparser/gtkdoc/annotations/tester.h.xml
@@ -28,6 +28,12 @@
       <description>small struct</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocAnnotation:
+ * @that: (allow-none): eventualy points to something
+ *
+ * small struct
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/bugs/tester.c.xml 
b/tests/scanner/annotationparser/gtkdoc/bugs/tester.c.xml
index 1197c9b..7d766c6 100644
--- a/tests/scanner/annotationparser/gtkdoc/bugs/tester.c.xml
+++ b/tests/scanner/annotationparser/gtkdoc/bugs/tester.c.xml
@@ -49,6 +49,25 @@ Second paragraph inside subsection.
 </refsect2>]]></description>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * SECTION:tester
+ * @short_description: module for gtk-doc unit test
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ *
+ * As described in http://bugzilla.gnome.org/show_bug.cgi?id=457077 it
+ * returns nothing.
+ *
+ * Some special characters need escaping. The tests should pass 100\%.
+ * Try a <ulink url="http://www.gtk.org/gtk-doc/#Top";>link containing a # char</ulink>.
+ *
+ * <refsect2 id="dummy-id">
+ * <title>more details</title>
+ * <para>
+ * Second paragraph inside subsection.
+ * </para>
+ * </refsect2>
+ */]]></output>
 </test>
 
 <test>
@@ -72,6 +91,12 @@ Second paragraph inside subsection.
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=141869</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_141869_a:
+ * @pid: arg
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=141869
+ */</output>
 </test>
 
 <test>
@@ -95,6 +120,12 @@ Second paragraph inside subsection.
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=141869</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_141869_b:
+ * @pid: arg
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=141869
+ */</output>
 </test>
 
 <test>
@@ -118,6 +149,12 @@ Second paragraph inside subsection.
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=379466</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_379466:
+ * @pid: arg
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=379466
+ */</output>
 </test>
 
 <test>
@@ -157,6 +194,16 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_380824:
+ * @arg: arg
+ *
+ * Returns a value.
+ * http://bugzilla.gnome.org/show_bug.cgi?id=380824
+ *
+ * Since: 0.1
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -181,6 +228,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_411739:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=411739
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -204,6 +258,12 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=419997</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_419997:
+ * @const_values: arg
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=419997
+ */</output>
 </test>
 
 <test>
@@ -227,6 +287,12 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=445693</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_445693:
+ * @pid: arg
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=445693
+ */</output>
 </test>
 
 <test>
@@ -251,6 +317,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_471014:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=471014
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -274,6 +347,12 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=446648</description>
     </docblock>
   </parser>
+  <output>/**
+ * Bug446648:
+ * @BUG_446648_FOO: foo
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=446648
+ */</output>
 </test>
 
 <test>
@@ -298,6 +377,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_552602:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=552602
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -322,6 +408,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_574654a:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=574654
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -345,6 +438,12 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=574654</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_574654b:
+ * @offset: skip this many items
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=574654
+ */</output>
 </test>
 
 <test>
@@ -361,6 +460,11 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=580300</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_580300a_get_type:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=580300
+ */</output>
 </test>
 
 <test>
@@ -384,6 +488,12 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=580300</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_580300b_get_type:
+ * @a: value
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=580300
+ */</output>
 </test>
 
 <test>
@@ -400,6 +510,11 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=580300</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_580300c_get_type:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=580300
+ */</output>
 </test>
 
 <test>
@@ -424,6 +539,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_580300d_get_type:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=580300
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -447,6 +569,12 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=597937</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_597937:
+ * @function_arg: value
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=597937
+ */</output>
 </test>
 
 <test>
@@ -471,6 +599,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_602518a:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=602518
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -495,6 +630,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_602518b:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=602518
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -519,6 +661,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_602518c:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=602518
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -547,6 +696,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=607445</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_607445:
+ * @a: parameter
+ * @n: parameter
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=607445
+ */</output>
 </test>
 
 <test>
@@ -575,6 +731,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=610257</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_610257:
+ * @der: parameter
+ * @len: parameter
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=610257
+ */</output>
 </test>
 
 <test>
@@ -599,6 +762,15 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
 </refsect3>]]></description>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * bug_623968a:
+ *
+ * <para>test</para>
+ * <refsect3>
+ *   <title>subsect</title>
+ *   <para>test</para>
+ * </refsect3>
+ */]]></output>
 </test>
 
 <test>
@@ -625,6 +797,16 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
 </refsect3>]]></description>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * bug_623968b:
+ *
+ * test
+ *
+ * <refsect3>
+ *   <title>subsect</title>
+ *   <para>test</para>
+ * </refsect3>
+ */]]></output>
 </test>
 
 <test>
@@ -641,6 +823,11 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description><![CDATA[<para>test</para>]]></description>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * bug_623968c:
+ *
+ * <para>test</para>
+ */]]></output>
 </test>
 
 <test>
@@ -665,6 +852,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_624200a:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=624200
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -689,6 +883,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_624200b:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=624200
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -722,6 +923,14 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=638330</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_638330:
+ * @arg1: arg1
+ * @data: data
+ * @length: length
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=638330
+ */</output>
 </test>
 
 <test>
@@ -750,6 +959,13 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>Outputs a message.</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_000000_va1:
+ * @name: a name
+ * @...: A printf-style message to output
+ *
+ * Outputs a message.
+ */</output>
 </test>
 
 <test>
@@ -766,6 +982,11 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=624001</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_624001a:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=624001
+ */</output>
 </test>
 
 <test>
@@ -782,6 +1003,11 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=624001</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_624001b:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=624001
+ */</output>
 </test>
 
 <test>
@@ -798,6 +1024,11 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=624001</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_624001c:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=624001
+ */</output>
 </test>
 
 <test>
@@ -814,6 +1045,11 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=624001</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_624001d:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=624001
+ */</output>
 </test>
 
 <test>
@@ -830,6 +1066,11 @@ http://bugzilla.gnome.org/show_bug.cgi?id=380824</description>
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=624001</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_624001e:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=624001
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/bugs/tester.h.xml 
b/tests/scanner/annotationparser/gtkdoc/bugs/tester.h.xml
index 39fe878..5dad3cb 100644
--- a/tests/scanner/annotationparser/gtkdoc/bugs/tester.h.xml
+++ b/tests/scanner/annotationparser/gtkdoc/bugs/tester.h.xml
@@ -33,6 +33,14 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=324535</description>
     </docblock>
   </parser>
+  <output>/**
+ * Bug324535:
+ * @BUG_324535_A: enum 1
+ * @BUG_324535_B: enum 2
+ * @BUG_324535_C: enum 3
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=324535
+ */</output>
 </test>
 
 <test>
@@ -56,6 +64,12 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=481811</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_481811:
+ * @x: argument
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=481811
+ */</output>
 </test>
 
 <test>
@@ -89,6 +103,14 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=501038</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_501038:
+ * @a: value
+ * @b: deprecated value
+ * @_b: scrambled deprecated value
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=501038
+ */</output>
 </test>
 
 <test>
@@ -112,6 +134,12 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=460127</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_460127:
+ * @a: field
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=460127
+ */</output>
 </test>
 
 <test>
@@ -128,6 +156,11 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=477532</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_477532:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=477532
+ */</output>
 </test>
 
 <test>
@@ -151,6 +184,12 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=446648</description>
     </docblock>
   </parser>
+  <output>/**
+ * Bug446648:
+ * @BUG_446648_FOO: field
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=446648
+ */</output>
 </test>
 
 <test>
@@ -174,6 +213,12 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=512154</description>
     </docblock>
   </parser>
+  <output>/**
+ * Bug512154:
+ * @index: field
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=512154
+ */</output>
 </test>
 
 <test>
@@ -207,6 +252,14 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=512155</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_512155a_function_pointer_t:
+ * @arg1: param 1
+ * @arg2: param 1
+ * @arg3: param 1
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=512155
+ */</output>
 </test>
 
 <test>
@@ -240,6 +293,14 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=512155</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_512155b_function_pointer_t:
+ * @arg1: param 1
+ * @arg2: param 1
+ * @arg3: param 1
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=512155
+ */</output>
 </test>
 
 <test>
@@ -273,6 +334,14 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=512155</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_512155c_function_pointer_t:
+ * @arg1: param 1
+ * @arg2: param 1
+ * @arg3: param 1
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=512155
+ */</output>
 </test>
 
 <test>
@@ -293,6 +362,13 @@
 <ulink url="http://bugzilla.gnome.org/show_bug.cgi?id=530758#c1";>Test</ulink>]]></description>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * BUG_530758:
+ *
+ * {{![CDATA[http://bugzilla.gnome.org/show_bug.cgi?id=530758#c1]]!}}
+ *
+ * <ulink url="http://bugzilla.gnome.org/show_bug.cgi?id=530758#c1";>Test</ulink>
+ */]]></output>
 </test>
 
 <test>
@@ -324,6 +400,14 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_532395a:
+ * @number: a number
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=532395
+ *
+ * Returns: number
+ */</output>
 </test>
 
 <test>
@@ -340,6 +424,11 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=532395</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_532395b:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=532395
+ */</output>
 </test>
 
 <test>
@@ -371,6 +460,14 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_544172:
+ * @self: object pointer.
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=544172
+ *
+ * Returns: result or %NULL.
+ */</output>
 </test>
 
 <test>
@@ -394,6 +491,12 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=554833</description>
     </docblock>
   </parser>
+  <output>/**
+ * bug_554833:
+ * @i: value;
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=554833
+ */</output>
 </test>
 
 <test>
@@ -418,6 +521,13 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * bug_554833_new:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=554833
+ *
+ * Returns: result
+ */</output>
 </test>
 
 <test>
@@ -446,6 +556,13 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=165425</description>
     </docblock>
   </parser>
+  <output>/**
+ * Bug165425a:
+ * @i: data as int
+ * @f: data as float
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=165425
+ */</output>
 </test>
 
 <test>
@@ -474,6 +591,13 @@
       <description>http://bugzilla.gnome.org/show_bug.cgi?id=165425</description>
     </docblock>
   </parser>
+  <output>/**
+ * Bug165425b:
+ * @i: data as int
+ * @f: data as float
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=165425
+ */</output>
 </test>
 
 <test>
@@ -507,6 +631,14 @@
       <description>https://bugzilla.gnome.org/show_bug.cgi?id=642998</description>
     </docblock>
   </parser>
+  <output>/**
+ * Bug642998:
+ * @red: red color intensity, from 0–255
+ * @green: green color intensity, from 0–255
+ * @blue: blue color intensity, from 0–255
+ *
+ * https://bugzilla.gnome.org/show_bug.cgi?id=642998
+ */</output>
 </test>
 
 <test>
@@ -555,6 +687,17 @@
       <description>https://bugzilla.gnome.org/show_bug.cgi?id=644291</description>
     </docblock>
   </parser>
+  <output>/**
+ * Bug644291:
+ * @BUG_644291_START: foo
+ * @BUG_644291_TEXT: bar
+ * @BUG_644291_END: milk
+ * @BUG_644291_ATTRIBUTE: comes
+ * @BUG_644291_XMLNS: from
+ * @BUG_644291_ASSIGN_TO: cows
+ *
+ * https://bugzilla.gnome.org/show_bug.cgi?id=644291
+ */</output>
 </test>
 
 <test>
@@ -583,6 +726,13 @@
       <description>Outputs a message.</description>
     </docblock>
   </parser>
+  <output>/**
+ * BUG_000000_VA2:
+ * @name: a name
+ * @...: A printf-style message to output
+ *
+ * Outputs a message.
+ */</output>
 </test>
 
 <test>
@@ -611,6 +761,13 @@
       <description>Outputs a message.</description>
     </docblock>
   </parser>
+  <output>/**
+ * BUG_000000_VA3:
+ * @name: a name
+ * @...: A printf-style message to output
+ *
+ * Outputs a message.
+ */</output>
 </test>
 
 <test>
@@ -631,6 +788,13 @@
 but not if we remove the blank line before "int b";</description>
     </docblock>
   </parser>
+  <output>/**
+ * Bug000000Scope:
+ *
+ * Opaque structure.
+ * "warning: Field descriptions for Bug000000Scope are missing in source code comment block."
+ * but not if we remove the blank line before "int b";
+ */</output>
 </test>
 
 <test>
@@ -664,6 +828,14 @@ but not if we remove the blank line before "int b";</description>
       <description>test.</description>
     </docblock>
   </parser>
+  <output>/**
+ * gst_play_marshal_BUFFER__BOXED:
+ * @closure: test
+ * @return_value: test
+ * @marshal_data: test
+ *
+ * test.
+ */</output>
 </test>
 
 <test>
@@ -680,6 +852,11 @@ but not if we remove the blank line before "int b";</description>
       <description>https://bugzilla.gnome.org/show_bug.cgi?id=656773</description>
     </docblock>
   </parser>
+  <output>/**
+ * BUG_656773a:
+ *
+ * https://bugzilla.gnome.org/show_bug.cgi?id=656773
+ */</output>
 </test>
 
 <test>
@@ -696,6 +873,11 @@ but not if we remove the blank line before "int b";</description>
       <description>https://bugzilla.gnome.org/show_bug.cgi?id=656773</description>
     </docblock>
   </parser>
+  <output>/**
+ * BUG_656773b:
+ *
+ * https://bugzilla.gnome.org/show_bug.cgi?id=656773
+ */</output>
 </test>
 
 <test>
@@ -712,6 +894,11 @@ but not if we remove the blank line before "int b";</description>
       <description>https://bugzilla.gnome.org/show_bug.cgi?id=656773</description>
     </docblock>
   </parser>
+  <output>/**
+ * BUG_656773c:
+ *
+ * https://bugzilla.gnome.org/show_bug.cgi?id=656773
+ */</output>
 </test>
 
 <test>
@@ -728,6 +915,11 @@ but not if we remove the blank line before "int b";</description>
       <description>https://bugzilla.gnome.org/show_bug.cgi?id=656946</description>
     </docblock>
   </parser>
+  <output>/**
+ * BUG_656946:
+ *
+ * https://bugzilla.gnome.org/show_bug.cgi?id=656946
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/empty/tester.c.xml 
b/tests/scanner/annotationparser/gtkdoc/empty/tester.c.xml
index 6419370..65bda61 100644
--- a/tests/scanner/annotationparser/gtkdoc/empty/tester.c.xml
+++ b/tests/scanner/annotationparser/gtkdoc/empty/tester.c.xml
@@ -29,6 +29,15 @@ As described in http://bugzilla.gnome.org/show_bug.cgi?id=457077 it
 returns nothing.]]></description>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * SECTION:tester
+ * @short_description: module for gtk-doc unit test
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ *
+ * As described in http://bugzilla.gnome.org/show_bug.cgi?id=457077 it
+ * returns nothing.
+ */]]></output>
 </test>
 
 <test>
@@ -52,6 +61,12 @@ returns nothing.]]></description>
       <description>lonely function</description>
     </docblock>
   </parser>
- </test>
+  <output>/**
+ * test:
+ * @a: arg
+ *
+ * lonely function
+ */</output>
+</test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/fail/tester.c.xml 
b/tests/scanner/annotationparser/gtkdoc/fail/tester.c.xml
index f76efdd..40fbbff 100644
--- a/tests/scanner/annotationparser/gtkdoc/fail/tester.c.xml
+++ b/tests/scanner/annotationparser/gtkdoc/fail/tester.c.xml
@@ -19,22 +19,27 @@
  * @title: GtkdocTesterNoLongDesc
  */</input>
   <parser>
-   <docblock>
-     <identifier>
-       <name>SECTION:tester_nolongdesc</name>
-     </identifier>
-     <parameters>
-       <parameter>
-         <name>short_description</name>
-         <description>module for gtk-doc unit test</description>
-       </parameter>
-       <parameter>
-         <name>title</name>
-         <description>GtkdocTesterNoLongDesc</description>
-       </parameter>
-     </parameters>
-   </docblock>
+    <docblock>
+      <identifier>
+        <name>SECTION:tester_nolongdesc</name>
+      </identifier>
+      <parameters>
+        <parameter>
+          <name>short_description</name>
+          <description>module for gtk-doc unit test</description>
+        </parameter>
+        <parameter>
+          <name>title</name>
+          <description>GtkdocTesterNoLongDesc</description>
+        </parameter>
+      </parameters>
+    </docblock>
   </parser>
+  <output>/**
+ * SECTION:tester_nolongdesc
+ * @short_description: module for gtk-doc unit test
+ * @title: GtkdocTesterNoLongDesc
+ */</output>
 </test>
 
 <test>
@@ -45,19 +50,25 @@
  * This file contains non-sense code for the sole purpose of testing the docs.
  */</input>
   <parser>
-   <docblock>
-     <identifier>
-       <name>SECTION:tester_noshortdesc</name>
-     </identifier>
-     <parameters>
-       <parameter>
-         <name>title</name>
-         <description>GtkdocTesterNoShortDesc</description>
-       </parameter>
-     </parameters>
-     <description>This file contains non-sense code for the sole purpose of testing the docs.</description>
-   </docblock>
+    <docblock>
+      <identifier>
+        <name>SECTION:tester_noshortdesc</name>
+      </identifier>
+      <parameters>
+        <parameter>
+          <name>title</name>
+          <description>GtkdocTesterNoShortDesc</description>
+        </parameter>
+      </parameters>
+      <description>This file contains non-sense code for the sole purpose of testing the docs.</description>
+    </docblock>
   </parser>
+  <output>/**
+ * SECTION:tester_noshortdesc
+ * @title: GtkdocTesterNoShortDesc
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ */</output>
 </test>
 
 <test>
@@ -69,23 +80,30 @@
  * This file contains non-sense code for the sole purpose of testing the docs.
  */</input>
   <parser>
-   <docblock>
-     <identifier>
-       <name>SECTION:tester_brokendocs</name>
-     </identifier>
-     <parameters>
-       <parameter>
-         <name>short_description</name>
-         <description>module for gtk-doc unit test</description>
-       </parameter>
-       <parameter>
-         <name>title</name>
-         <description>GtkdocTesterBrokenDocs</description>
-       </parameter>
-     </parameters>
-     <description>This file contains non-sense code for the sole purpose of testing the docs.</description>
-   </docblock>
+    <docblock>
+      <identifier>
+        <name>SECTION:tester_brokendocs</name>
+      </identifier>
+      <parameters>
+        <parameter>
+          <name>short_description</name>
+          <description>module for gtk-doc unit test</description>
+        </parameter>
+        <parameter>
+          <name>title</name>
+          <description>GtkdocTesterBrokenDocs</description>
+        </parameter>
+      </parameters>
+      <description>This file contains non-sense code for the sole purpose of testing the docs.</description>
+    </docblock>
   </parser>
+  <output>/**
+ * SECTION:tester_brokendocs
+ * @short_description: module for gtk-doc unit test
+ * @title: GtkdocTesterBrokenDocs
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ */</output>
 </test>
 
 <test>
@@ -93,12 +111,15 @@
  * func_no_docs:
  */</input>
   <parser>
-   <docblock>
-     <identifier>
-       <name>func_no_docs</name>
-     </identifier>
-   </docblock>
+    <docblock>
+      <identifier>
+        <name>func_no_docs</name>
+      </identifier>
+    </docblock>
   </parser>
+  <output>/**
+ * func_no_docs:
+ */</output>
 </test>
 
 <test>
@@ -108,13 +129,18 @@
  * Here we document the function but not the parameters.
  */</input>
   <parser>
-   <docblock>
-     <identifier>
-       <name>func_no_item_docs</name>
-     </identifier>
-     <description>Here we document the function but not the parameters.</description>
-   </docblock>
+    <docblock>
+      <identifier>
+        <name>func_no_item_docs</name>
+      </identifier>
+      <description>Here we document the function but not the parameters.</description>
+    </docblock>
   </parser>
+  <output>/**
+ * func_no_item_docs:
+ *
+ * Here we document the function but not the parameters.
+ */</output>
 </test>
 
 <test>
@@ -125,19 +151,25 @@
  * Here we document the function but not all the parameters.
  */</input>
   <parser>
-   <docblock>
-     <identifier>
-       <name>func_incomplete_docs</name>
-     </identifier>
-     <parameters>
-       <parameter>
-         <name>a</name>
-         <description>a value</description>
-       </parameter>
-     </parameters>
-     <description>Here we document the function but not all the parameters.</description>
-   </docblock>
+    <docblock>
+      <identifier>
+        <name>func_incomplete_docs</name>
+      </identifier>
+      <parameters>
+        <parameter>
+          <name>a</name>
+          <description>a value</description>
+        </parameter>
+      </parameters>
+      <description>Here we document the function but not all the parameters.</description>
+    </docblock>
   </parser>
+  <output>/**
+ * func_incomplete_docs:
+ * @a: a value
+ *
+ * Here we document the function but not all the parameters.
+ */</output>
 </test>
 
 <test>
@@ -150,27 +182,35 @@
  * Here we document the function and more than the actual parameters.
  */</input>
   <parser>
-   <docblock>
-     <identifier>
-       <name>func_unused_docs</name>
-     </identifier>
-     <parameters>
-       <parameter>
-         <name>a</name>
-         <description>a value</description>
-       </parameter>
-       <parameter>
-         <name>b</name>
-         <description>a value</description>
-       </parameter>
-       <parameter>
-         <name>c</name>
-         <description>an unexisting value</description>
-       </parameter>
-     </parameters>
-     <description>Here we document the function and more than the actual parameters.</description>
-   </docblock>
+    <docblock>
+      <identifier>
+        <name>func_unused_docs</name>
+      </identifier>
+      <parameters>
+        <parameter>
+          <name>a</name>
+          <description>a value</description>
+        </parameter>
+        <parameter>
+          <name>b</name>
+          <description>a value</description>
+        </parameter>
+        <parameter>
+          <name>c</name>
+          <description>an unexisting value</description>
+        </parameter>
+      </parameters>
+      <description>Here we document the function and more than the actual parameters.</description>
+    </docblock>
   </parser>
+  <output>/**
+ * func_unused_docs:
+ * @a: a value
+ * @b: a value
+ * @c: an unexisting value
+ *
+ * Here we document the function and more than the actual parameters.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/fail/tester.h.xml 
b/tests/scanner/annotationparser/gtkdoc/fail/tester.h.xml
index 2076e52..069ae71 100644
--- a/tests/scanner/annotationparser/gtkdoc/fail/tester.h.xml
+++ b/tests/scanner/annotationparser/gtkdoc/fail/tester.h.xml
@@ -16,6 +16,11 @@
       <description>Here we document the macro but not the parameters.</description>
     </docblock>
   </parser>
+  <output>/**
+ * MACRO_NO_ITEM_DOCS:
+ *
+ * Here we document the macro but not the parameters.
+ */</output>
 </test>
 
 <test>
@@ -39,6 +44,12 @@
       <description>Here we document the macro but not all the parameters.</description>
     </docblock>
   </parser>
+  <output>/**
+ * MACRO_INCOMPLETE_DOCS:
+ * @a: a value
+ *
+ * Here we document the macro but not all the parameters.
+ */</output>
 </test>
 
 <test>
@@ -72,6 +83,14 @@
       <description>Here we document the macro and more than the actual parameters.</description>
     </docblock>
   </parser>
+  <output>/**
+ * MACRO_UNUSED_DOCS:
+ * @a: a value
+ * @b: a value
+ * @c: an unexisting value
+ *
+ * Here we document the macro and more than the actual parameters.
+ */</output>
 </test>
 
 <test>
@@ -90,6 +109,12 @@
 http://bugzilla.gnome.org/show_bug.cgi?id=568711</description>
     </docblock>
   </parser>
+  <output>/**
+ * EnumNoItemDocs:
+ *
+ * Here we document the enum but not the values.
+ * http://bugzilla.gnome.org/show_bug.cgi?id=568711
+ */</output>
 </test>
 
 <test>
@@ -113,6 +138,12 @@ http://bugzilla.gnome.org/show_bug.cgi?id=568711</description>
       <description>Here we document the enum but not all the values.</description>
     </docblock>
   </parser>
+  <output>/**
+ * EnumIncompleteDocs:
+ * @ENUM_INCOMPLETE_DOCS_1: a value
+ *
+ * Here we document the enum but not all the values.
+ */</output>
 </test>
 
 <test>
@@ -146,6 +177,14 @@ http://bugzilla.gnome.org/show_bug.cgi?id=568711</description>
       <description>Here we document the enum and more than the actual values.</description>
     </docblock>
   </parser>
+  <output>/**
+ * EnumUnusedDocs:
+ * @ENUM_UNUSED_DOCS_1: a value
+ * @ENUM_UNUSED_DOCS_2: a value
+ * @ENUM_UNUSED_DOCS_3: an unexisting value
+ *
+ * Here we document the enum and more than the actual values.
+ */</output>
 </test>
 
 <test>
@@ -162,6 +201,11 @@ http://bugzilla.gnome.org/show_bug.cgi?id=568711</description>
       <description>Here we document the struct but not the values.</description>
     </docblock>
   </parser>
+  <output>/**
+ * StructNoItemDocs:
+ *
+ * Here we document the struct but not the values.
+ */</output>
 </test>
 
 <test>
@@ -185,6 +229,12 @@ http://bugzilla.gnome.org/show_bug.cgi?id=568711</description>
       <description>Here we document the struct but not all the values.</description>
     </docblock>
   </parser>
+  <output>/**
+ * StructIncompleteDocs:
+ * @a: a value
+ *
+ * Here we document the struct but not all the values.
+ */</output>
 </test>
 
 <test>
@@ -218,6 +268,14 @@ http://bugzilla.gnome.org/show_bug.cgi?id=568711</description>
       <description>Here we document the struct and more than the actual values.</description>
     </docblock>
   </parser>
+  <output>/**
+ * StructUnusedDocs:
+ * @a: a value
+ * @b: a value
+ * @c: an unexisting value
+ *
+ * Here we document the struct and more than the actual values.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/giface.c.xml 
b/tests/scanner/annotationparser/gtkdoc/gobject/giface.c.xml
index dc9ae53..c295edb 100644
--- a/tests/scanner/annotationparser/gtkdoc/gobject/giface.c.xml
+++ b/tests/scanner/annotationparser/gtkdoc/gobject/giface.c.xml
@@ -57,6 +57,26 @@ Just incase you wonder, special caracters can be escaped with a \ like in \%
 or \# or even \  ]]></description>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * SECTION:iface
+ * @title: GtkdocIface
+ * @short_description: interface for gtk-doc unit test
+ * @see_also: #GtkdocObject
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ * We can link to the #GtkdocIface:itest property and the #GtkdocIface::itest
+ * signal.
+ * An instance can be configured using the gtkdoc_iface_configure() function.
+ *
+ * I can haz pictures too!
+ * <mediaobject>
+ *   <imageobject><imagedata fileref="home.png" format="PNG"/></imageobject>
+ *   <caption><para>Home sweet home.</para></caption>
+ * </mediaobject>
+ *
+ * Just incase you wonder, special caracters can be escaped with a \ like in \%
+ * or \# or even \  
+ */]]></output>
 </test>
 
 <test>
@@ -90,6 +110,14 @@ or \# or even \  ]]></description>
       <description>This file contains non-sense code for the sole purpose of testing the docs.</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:iface2
+ * @title: GtkdocIface2
+ * @short_description: interface with a prerequisite for gtk-doc unit test
+ * @see_also: #GtkdocObject, #GtkdocIface
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ */</output>
 </test>
 
 <test>
@@ -126,6 +154,15 @@ or \# or even \  ]]></description>
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * gtkdoc_iface_configure:
+ * @config: settings
+ *
+ * Configure a new instance
+ *
+ * Returns: %TRUE for sucess or %FALSE in case of an error
+ * Since: 0.1
+ */</output>
 </test>
 
 <test>
@@ -149,6 +186,12 @@ or \# or even \  ]]></description>
       <description>The event has been triggered.</description>
     </docblock>
   </parser>
+  <output>    /**
+     * GtkdocIface::itest:
+     * @self: myself
+     *
+     * The event has been triggered.
+     */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/giface.h.xml 
b/tests/scanner/annotationparser/gtkdoc/gobject/giface.h.xml
index 58c2285..e3ed09c 100644
--- a/tests/scanner/annotationparser/gtkdoc/gobject/giface.h.xml
+++ b/tests/scanner/annotationparser/gtkdoc/gobject/giface.h.xml
@@ -16,6 +16,11 @@
       <description>opaque instance of gtk-doc unit test interface</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocIface:
+ *
+ * opaque instance of gtk-doc unit test interface
+ */</output>
 </test>
 
 <test>
@@ -32,6 +37,11 @@
       <description>opaque instance of gtk-doc unit test interface</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocIface2:
+ *
+ * opaque instance of gtk-doc unit test interface
+ */</output>
 </test>
 
 <test>
@@ -60,6 +70,13 @@
       <description>class data of gtk-doc unit test interface</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocIfaceInterface:
+ * @parent: this is a bug :/
+ * @test: overideable method
+ *
+ * class data of gtk-doc unit test interface
+ */</output>
 </test>
 
 <test>
@@ -88,6 +105,13 @@
       <description>This macro does nothing.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GTKDOC_IFACE_MACRO_DUMMY:
+ * @parameter_1: first arg
+ * @parameter_2: second arg
+ *
+ * This macro does nothing.
+ */</output>
 </test>
 
 <test>
@@ -124,6 +148,15 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * GTKDOC_IFACE_MACRO_SUM:
+ * @parameter_1: first arg
+ * @parameter_2: second arg
+ *
+ * This macro adds its args.
+ *
+ * Returns: the sum of @parameter_1 and @parameter_2
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/gobject.c.xml 
b/tests/scanner/annotationparser/gtkdoc/gobject/gobject.c.xml
index 111b5d6..6b8b34f 100644
--- a/tests/scanner/annotationparser/gtkdoc/gobject/gobject.c.xml
+++ b/tests/scanner/annotationparser/gtkdoc/gobject/gobject.c.xml
@@ -100,6 +100,46 @@ This example serves two main purposes:
 Nothing more to say.]]></description>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * SECTION:object
+ * @title: GtkdocObject
+ * @short_description: class for gtk-doc unit test
+ * @see_also: #GtkdocIface
+ * @Image: object.png
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ * We can link to the #GtkdocObject:otest property and the #GtkdocObject::otest
+ * signal.
+ *
+ * When subclassing it is useful to override the #GtkdocObjectClass.test()
+ * method. The #GtkdocObjectClass.foo_bar() vmethod lets you refine your
+ * frobnicator.
+ *
+ * A new instance can be created using the gtkdoc_object_new() function. The
+ * whole lifecycle usualy looks like shown in this example:
+ * |[{{!-- language="C" --!}}
+ * GObject *myobj;
+ *
+ * myobj = gtkdoc_object_new();
+ * // do somehing
+ * g_object_unref (myobj);
+ * ]|
+ *
+ * # Examples #
+ *
+ * You can also change parameters:
+ * <informalexample>
+ * <programlisting language="c"><xi:include xmlns:xi="http://www.w3.org/2003/XInclude"; parse="text" 
href="../../examples/gobject.c" /></programlisting>
+ * </informalexample>
+ *
+ * This example serves two main purposes:
+ * - testing conversion (long description
+ *   follows here)
+ * - catching bugs
+ * - having an example
+ *
+ * Nothing more to say.
+ */]]></output>
 </test>
 
 <test>
@@ -145,6 +185,20 @@ All the internal details go here or not:
 - single item list</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:object2
+ * @title: GtkdocObject2
+ * @short_description: class with interface for gtk-doc unit test
+ * @see_also: #GtkdocIface
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ *
+ * Internals
+ * =========
+ *
+ * All the internal details go here or not:
+ * - single item list
+ */</output>
 </test>
 
 <test>
@@ -180,6 +234,17 @@ All the internal details go here or not:
       </tags>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * gtkdoc_object_new:
+ *
+ * Create a new instance
+ * <note><para>
+ *   This will only work if you have called g_type_init() before.
+ * </para></note>
+ *
+ * Returns: the instance or %NULL in case of an error
+ * Since: 0.1
+ */]]></output>
 </test>
 
 <test>
@@ -224,6 +289,17 @@ All the internal details go here or not:
       </tags>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * gtkdoc_object_set_otest:
+ * @self: the object
+ * @value: the new otest value, whose description extends further than one
+ *  line will allow
+ *
+ * Set the #GtkdocObject:otest property.
+ *
+ * Deprecated: Use g_object_set(obj,&quot;otest&quot;,value,NULL); instead.
+ * Since: 0.5
+ */]]></output>
 </test>
 
 <test>
@@ -272,6 +348,21 @@ complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
       </tags>
     </docblock>
   </parser>
+  <output><![CDATA[/**
+ * gtkdoc_object_frobnicate:
+ * @self: the object
+ * @n: number of iterations
+ *
+ * Frobnicate the content of @self @n times. This implements a
+ * complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
+ * <footnote>
+ *  <para>
+ *    Negative frobnication can lead to unexpected behaviour.
+ *  </para>
+ * </footnote>
+ *
+ * Since: 0.5
+ */]]></output>
 </test>
 
 <test>
@@ -308,6 +399,15 @@ complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * gtkdoc_object_fooify:
+ * @self: the object
+ * @...: a NULL terminated list of arguments
+ *
+ * Fooify the content of @self.
+ *
+ * Returns: %TRUE for success
+ */</output>
 </test>
 
 <test>
@@ -331,6 +431,12 @@ complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
       <description>The event has been triggered.</description>
     </docblock>
   </parser>
+  <output>  /**
+   * GtkdocObject::otest:
+   * @self: myself
+   *
+   * The event has been triggered.
+   */</output>
 </test>
 
 <test>
@@ -362,6 +468,14 @@ complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
       </tags>
     </docblock>
   </parser>
+  <output>  /**
+   * GtkdocObject::dep-otest:
+   * @self: myself
+   *
+   * The event has been triggered.
+   *
+   * Deprecated: Use the #GtkdocObject::otest signal instead.
+   */</output>
 </test>
 
 <test>
@@ -378,6 +492,11 @@ complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
       <description>Something has happened.</description>
     </docblock>
   </parser>
+  <output>  /**
+   * GtkdocObject::strings-changed:
+   *
+   * Something has happened.
+   */</output>
 </test>
 
 <test>
@@ -394,6 +513,11 @@ complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
       <description>Something has happened.</description>
     </docblock>
   </parser>
+  <output>  /**
+   * GtkdocObject::variant-changed:
+   *
+   * Something has happened.
+   */</output>
 </test>
 
 <test>
@@ -415,6 +539,11 @@ complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
       </tags>
     </docblock>
   </parser>
+  <output>  /**
+   * GtkdocObject:otest:
+   *
+   * Since: 0.1
+   */</output>
 </test>
 
 <test>
@@ -436,6 +565,11 @@ complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
       </tags>
     </docblock>
   </parser>
+  <output>  /**
+   * GtkdocObject:dep-otest:
+   *
+   * Deprecated: use #GtkdocObject:otest property
+   */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/gobject.h.xml 
b/tests/scanner/annotationparser/gtkdoc/gobject/gobject.h.xml
index 2fb9696..ec68a7f 100644
--- a/tests/scanner/annotationparser/gtkdoc/gobject/gobject.h.xml
+++ b/tests/scanner/annotationparser/gtkdoc/gobject/gobject.h.xml
@@ -16,6 +16,11 @@
       <description>instance data of gtk-doc unit test class</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocObject:
+ *
+ * instance data of gtk-doc unit test class
+ */</output>
 </test>
 
 <test>
@@ -54,6 +59,15 @@
       <description>class data of gtk-doc unit test class</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocObjectClass:
+ * @parent: this is a bug :/
+ * @test: overideable method
+ * @ping: can be used before calling the @test() function
+ * @foo_bar: lets you refine your frobnicator
+ *
+ * class data of gtk-doc unit test class
+ */</output>
 </test>
 
 <test>
@@ -70,6 +84,11 @@
       <description>instance data of gtk-doc unit test class</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocObject2:
+ *
+ * instance data of gtk-doc unit test class
+ */</output>
 </test>
 
 <test>
@@ -93,6 +112,12 @@
       <description>class data of gtk-doc unit test class</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocObject2Class:
+ * @parent: this is a bug :/
+ *
+ * class data of gtk-doc unit test class
+ */</output>
 </test>
 
 <test>
@@ -129,6 +154,15 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * GTKDOC_OBJECT_MACRO_DUMMY:
+ * @parameter_1: first arg
+ * @parameter_2: second arg
+ *
+ * This macro does nothing.
+ *
+ * Since: 0.1
+ */</output>
 </test>
 
 <test>
@@ -165,6 +199,15 @@
       </tags>
     </docblock>
   </parser>
+  <output>/**
+ * GTKDOC_OBJECT_MACRO_SUM:
+ * @parameter_1: first arg
+ * @parameter_2: second arg
+ *
+ * This macro adds its args.
+ *
+ * Returns: the sum of @parameter_1 and @parameter_2
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.c.xml 
b/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.c.xml
index 78f11b2..17d2356 100644
--- a/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.c.xml
+++ b/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.c.xml
@@ -33,6 +33,14 @@
       <description>This file contains non-sense code for the sole purpose of testing the docs.</description>
     </docblock>
   </parser>
+  <output>/**
+ * SECTION:types
+ * @title: GtkdocTypes
+ * @short_description: other gobject types for gtk-doc unit test
+ * @see_also: #GtkdocObject, #GtkdocIface
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.h.xml 
b/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.h.xml
index 644d594..7331a55 100644
--- a/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.h.xml
+++ b/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.h.xml
@@ -30,6 +30,14 @@
       <description>Enum values for the #GtkdocEnum type.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocEnum:
+ * @GTKDOC_ENUM_V1: first
+ * @GTKDOC_ENUM_V2: second
+ *    Since: 0.10
+ *
+ * Enum values for the #GtkdocEnum type.
+ */</output>
 </test>
 
 <test>
@@ -58,6 +66,13 @@
       <description>Unboxed plain old data that should default to public members.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocPlainOldData:
+ * @n: Some integer member.
+ * @x: Some floating point member.
+ *
+ * Unboxed plain old data that should default to public members.
+ */</output>
 </test>
 
 <test>
@@ -86,6 +101,13 @@
       <description>Boxed plain old data that should default to public members.</description>
     </docblock>
   </parser>
+  <output>/**
+ * GtkdocBoxedPlainOldData:
+ * @n: Some integer member.
+ * @x: Some floating point member.
+ *
+ * Boxed plain old data that should default to public members.
+ */</output>
 </test>
 
 </tests>
diff --git a/tests/scanner/annotationparser/test_parser.py b/tests/scanner/annotationparser/test_parser.py
index 99ef2c2..ef4d746 100644
--- a/tests/scanner/annotationparser/test_parser.py
+++ b/tests/scanner/annotationparser/test_parser.py
@@ -22,8 +22,7 @@
 '''
 test_parser.py
 
-Tests ensuring the "parse tree" built by annotationparser.py
-continues to function correctly.
+Tests ensuring annotationparser.py continues to function correctly.
 '''
 
 
@@ -33,7 +32,7 @@ import subprocess
 import unittest
 import xml.etree.ElementTree as etree
 
-from giscanner.annotationparser import GtkDocCommentBlockParser
+from giscanner.annotationparser import GtkDocCommentBlockParser, GtkDocCommentBlockWriter
 from giscanner.ast import Namespace
 from giscanner.message import MessageLogger, WARNING, ERROR, FATAL
 
@@ -120,6 +119,31 @@ class TestCommentBlock(unittest.TestCase):
                 msg += self._diff_messages([expected_message], [emitted_message])
                 self.assertTrue(expected_message == emitted_message, msg)
 
+            # Compare serialized with expected comment block
+            expected_serialized = testcase.find(ns('{}output'))
+            indent = True
+
+            if expected_serialized is None:
+                expected_serialized = ''
+            else:
+                if 'indent' in expected_serialized.attrib:
+                    indent = expected_serialized.attrib['indent']
+                    if indent.lower() in ('false', '0'):
+                        indent = False
+                    elif indent.lower() in ('true', '1'):
+                        indent = True
+                    else:
+                        self.assert_(False, 'Unknown value for "indent" attribute: %s' % (indent))
+
+                expected_serialized = expected_serialized.text + '\n' or None
+
+            commentblockwriter = GtkDocCommentBlockWriter(indent=indent)
+            serialized = commentblockwriter.write(parsed_docblock)
+
+            msg = 'Serialized comment block does not match expected output:\n\n'
+            msg += self._diff_messages(expected_serialized.split('\n'), serialized.split('\n'))
+            self.assertTrue(expected_serialized == serialized, msg)
+
         return do_test
 
     def parsed2tree(self, docblock):
@@ -230,8 +254,6 @@ class TestCommentBlock(unittest.TestCase):
         return parsed
 
     def expected2tree(self, docblock):
-        # Note: this sucks, but we can't rely on etree.tostring() to generate useable output :(
-
         expected = ''
 
         if docblock is not None:
@@ -364,6 +386,7 @@ def create_tests(logger, tests_dir, tests_file):
 
     fix_cdata_elements = tests_tree.findall(ns('{}test/{}input'))
     fix_cdata_elements += tests_tree.findall(ns('.//{}description'))
+    fix_cdata_elements += tests_tree.findall(ns('{}test/{}output'))
 
     for element in fix_cdata_elements:
         if element.text:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]