summaryrefslogtreecommitdiff
path: root/tests/warn
diff options
context:
space:
mode:
Diffstat (limited to 'tests/warn')
-rw-r--r--tests/warn/Makefile.am7
-rw-r--r--tests/warn/annotationparser.h194
-rw-r--r--tests/warn/callback-invalid-scope.h11
-rw-r--r--tests/warn/invalid-array.h12
-rw-r--r--tests/warn/invalid-closure.h2
-rw-r--r--tests/warn/invalid-element-type.h53
-rw-r--r--tests/warn/invalid-option.h2
-rw-r--r--tests/warn/invalid-out.h2
-rw-r--r--tests/warn/invalid-transfer.h6
-rw-r--r--tests/warn/missing-element-type.h8
-rw-r--r--tests/warn/return-gobject.h2
-rw-r--r--tests/warn/unknown-parameter.h20
-rw-r--r--tests/warn/warningtester.py33
13 files changed, 106 insertions, 246 deletions
diff --git a/tests/warn/Makefile.am b/tests/warn/Makefile.am
index c4354223..e7a39345 100644
--- a/tests/warn/Makefile.am
+++ b/tests/warn/Makefile.am
@@ -4,7 +4,6 @@ TESTS = \
annotationparser.h \
callback-invalid-scope.h \
callback-missing-scope.h \
- return-gobject.h \
invalid-array.h \
invalid-closure.h \
invalid-constructor.h \
@@ -14,9 +13,11 @@ TESTS = \
invalid-out.h \
invalid-transfer.h \
missing-element-type.h \
+ return-gobject.h \
unknown-parameter.h \
unresolved-type.h
-EXTRA_DIST = warningtester.py common.h $(TESTS)
+LOG_COMPILER = env PYTHONPATH=$(top_builddir):$(top_srcdir) TOP_BUILDDIR=$(top_builddir) UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) \
+ $(PYTHON) $(srcdir)/warningtester.py
-TESTS_ENVIRONMENT = PYTHONPATH=$(top_builddir):$(top_srcdir) TOP_BUILDDIR=$(top_builddir) UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) $(PYTHON) $(srcdir)/warningtester.py
+EXTRA_DIST = warningtester.py common.h $(TESTS)
diff --git a/tests/warn/annotationparser.h b/tests/warn/annotationparser.h
index ff9030e4..12dc4cc7 100644
--- a/tests/warn/annotationparser.h
+++ b/tests/warn/annotationparser.h
@@ -1,205 +1,27 @@
#include "common.h"
/**
- * test_symbol_twice_documented:
+ * test_symbol_thrice_documented:
*
* Documenting the same thing multiple times can lead to subtle bugs.
* For example, one comment block might have correct annotations...
**/
-void test_symbol_twice_documented();
+void test_symbol_thrice_documented();
/**
- * test_symbol_twice_documented:
+ * test_symbol_thrice_documented:
*
* ...and a different comment block (out of sync with the above) might have
- * no annotations at all. The last comment block seen by the parser "wins".
+ * no annotations at all. The last comment block seen by the parser "wins"...
**/
-// EXPECT:12: Warning: Test: multiple comment blocks documenting 'test_symbol_twice_documented:' identifier.
+// EXPECT:11: Warning: Test: multiple comment blocks documenting 'test_symbol_thrice_documented:' identifier (already seen at annotationparser.h:3).
/**
- * test_symbol_missing_colon
+ * test_symbol_thrice_documented:
*
- * Forgotten colon above will result in a warning.
+ * ...and yet another one.
**/
-// EXPECT:22: Warning: Test: missing ':' at column 29:
-//+ * test_symbol_missing_colon
-//+ ^
-
-
-/**
- * GtkWidget:test_property_missing_colon
- *
- * Forgotten colon above will result in a warning.
- **/
-
-// EXPECT:33: Warning: Test: missing ':' at column 41:
-//+ * GtkWidget:test_property_missing_colon
-//+ ^
-
-
-/**
- * GtkWidget::test_signal_missing_colon
- *
- * Forgotten colon above will result in a warning.
- **/
-
-// EXPECT:44: Warning: Test: missing ':' at column 40:
-//+ * GtkWidget::test_signal_missing_colon
-//+ ^
-
-
-/**
- * This is not a valid section identifier
- * SECTION:test_invalid_section_idetifier
- *
- * Above identifier will result in a warning.
- **/
-
-// EXPECT:55: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
-//+ * This is not a valid section identifier
-//+ ^
-
-
-/**
- * test_unexpected_parameter:
- * @param1: first parameter
- *
- * Parameters should come before the comment block description
- *
- * Returns: something
- * @param2: second parameter
- **/
-
-// EXPECT:73: Warning: Test: '@param2' parameter unexpected at this location:
-//+ * @param2: second parameter
-//+ ^
-
-
-/**
- * test_multiple_returns_tag_and_parameter:
- *
- * Multiple return value warnings are checked for when a returns
- * parameter is encountered.
- *
- * Return Value: something
- * @returns: something
- */
-
-// EXPECT:88: Warning: Test: '@returns' parameter unexpected at this location:
-//+ * @returns: something
-//+ ^
-// EXPECT:88: Warning: Test: encountered multiple 'Returns' parameters or tags for 'test_multiple_returns_tag_and_parameter'.
-
-
-/**
- * test_multiple_parameters:
- * @param1: first parameter
- * @param1: first parameter
- **/
-
-// EXPECT:100: Warning: Test: multiple '@param1' parameters for identifier 'test_multiple_parameters':
-//+ * @param1: first parameter
-//+ ^
-
-
-/**
- * test_unexpected_tag:
- * @param1: first parameter
- * Returns: something
- *
- * Tags should go after the comment block description
- **/
-
-// EXPECT:111: Warning: Test: 'Returns:' tag unexpected at this location:
-//+ * Returns: something
-//+ ^
-
-
-/**
- * test_multiple_returns_tag:
- * @returns: something
- *
- * Multiple return value warnings are checked for when returns tag is used
- *
- * Returns: anything
- * Return value: whatever
- **/
-
-// EXPECT:127: Warning: Test: encountered multiple 'Returns' parameters or tags for 'test_multiple_returns_tag'.
-// EXPECT:128: Warning: Test: encountered multiple 'Returns' parameters or tags for 'test_multiple_returns_tag'.
-
-
-/**
- * test_multiple_tags:
- *
- * Since: 3.0
- * Since: 3.0
- **/
-
-// EXPECT:139: Warning: Test: multiple 'Since:' tags for identifier 'test_multiple_tags':
-//+ * Since: 3.0
-//+ ^
-
-
-/**
- * test_tag_annotatable:
- *
- * There's currently 2 tags that can be annotated, so these don't emit warnings
- *
- * Returns: (allow-none): something
- * Attributes: (free) (form) (annotations)
- **/
-
-/**
- * test_tag_not_annotatable:
- *
- * Tags (except Returns: and Attributes:) don't have annotations
- *
- * Since: (allow-none): 2.24
- **/
-
-// EXPECT:161: Warning: Test: annotations not supported for tag 'Since:'.
-
-
-/**
- * test_multiline_annotations_on_parameter:
- * @param1: (allow-none)
- * (transfer full): first parameter
- *
- * Annotations spanning multiple lines are not valid
- **/
-
-// EXPECT:170: Warning: Test: ignoring invalid multiline annotation continuation:
-//+ * (transfer full): first parameter
-//+ ^
-
-
-/**
- * test_multiline_annotations_on_tag:
- *
- * Annotations spanning multiple lines are not valid
- *
- * Returns: (allow-none)
- * (transfer full): something
- **/
-
-// EXPECT:186: Warning: Test: ignoring invalid multiline annotation continuation:
-//+ * (transfer full): something
-//+ ^
-
-
-/**
-
- * regress_test_invalid_comment:
- * @foo: a param
- *
- * invalid comment with a line without
- * https://bugzilla.gnome.org/show_bug.cgi?id=673806
- */
-
-// EXPECT:195: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
-//+
-//+^
+// EXPECT:21: Warning: Test: multiple comment blocks documenting 'test_symbol_thrice_documented:' identifier (already seen at annotationparser.h:11).
diff --git a/tests/warn/callback-invalid-scope.h b/tests/warn/callback-invalid-scope.h
index 583dc0ca..34292a89 100644
--- a/tests/warn/callback-invalid-scope.h
+++ b/tests/warn/callback-invalid-scope.h
@@ -7,7 +7,7 @@
*/
void test_callback_invalid(GCallback *callback, gpointer user_data);
-// EXPECT:5: Warning: Test: invalid scope annotation value: 'invalid'
+// EXPECT:5: Warning: Test: invalid "scope" annotation option: "invalid"
/**
* test_callback_invalid2:
@@ -16,7 +16,7 @@ void test_callback_invalid(GCallback *callback, gpointer user_data);
*/
void test_callback_invalid2(GCallback *callback, gpointer user_data);
-// EXPECT:14: Warning: Test: scope annotation needs a value
+// EXPECT:14: Warning: Test: "scope" annotation needs one option, none given
/**
* test_callback_invalid3:
@@ -25,7 +25,8 @@ void test_callback_invalid2(GCallback *callback, gpointer user_data);
*/
void test_callback_invalid3(GCallback *callback, gpointer user_data);
-// EXPECT:23: Warning: Test: scope annotation needs one value, not 2
+// EXPECT:23: Warning: Test: "scope" annotation needs one option, 2 given
+// EXPECT:23: Warning: Test: invalid "scope" annotation option: "invalid"
-// EXPECT:13: Warning: Test: test_callback_invalid2: argument callback: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
-// EXPECT:22: Warning: Test: test_callback_invalid3: argument callback: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
+// EXPECT:12: Warning: Test: test_callback_invalid2: argument callback: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
+// EXPECT:21: Warning: Test: test_callback_invalid3: argument callback: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
diff --git a/tests/warn/invalid-array.h b/tests/warn/invalid-array.h
index a4a4e47e..b9b828cf 100644
--- a/tests/warn/invalid-array.h
+++ b/tests/warn/invalid-array.h
@@ -7,7 +7,7 @@
void
test_invalid_array (char ***out1);
-// EXPECT:5: Warning: Test: invalid array annotation value: 'foobar'
+// EXPECT:5: Warning: Test: invalid "array" annotation option: "foobar"
/**
* test_invalid_array_zero_terminated:
@@ -18,8 +18,8 @@ void
test_invalid_array_zero_terminated (char ***out1,
char ***out2);
-// EXPECT:14: Warning: Test: array option zero-terminated needs a value
-// EXPECT:15: Warning: Test: invalid array zero-terminated option value 'foobar', must be an integer
+// EXPECT:14: Warning: Test: "array" annotation option "zero-terminated" needs a value
+// EXPECT:15: Warning: Test: invalid "array" annotation option "zero-terminated" value "foobar", must be an integer
/**
* test_invalid_array_fixed_size:
@@ -30,8 +30,8 @@ void
test_invalid_array_fixed_size (char ***out1,
char ***out2);
-// EXPECT:26: Warning: Test: array option fixed-size needs a value
-// EXPECT:27: Warning: Test: invalid array fixed-size option value 'foobar', must be an integer
+// EXPECT:26: Warning: Test: "array" annotation option "fixed-size" needs a value
+// EXPECT:27: Warning: Test: invalid "array" annotation option "fixed-size" value "foobar", must be an integer
/**
* test_invalid_array_length:
@@ -41,4 +41,4 @@ void
test_invalid_array_length (char ***out1,
char ***out2);
-// EXPECT:38: Warning: Test: array option length needs a value
+// EXPECT:38: Warning: Test: "array" annotation option "length" needs a value
diff --git a/tests/warn/invalid-closure.h b/tests/warn/invalid-closure.h
index 50ba0864..9769804b 100644
--- a/tests/warn/invalid-closure.h
+++ b/tests/warn/invalid-closure.h
@@ -5,4 +5,4 @@
*/
void test_invalid_closure(int param);
-// EXPECT:4: Warning: Test: closure takes at most 1 value, 2 given
+// EXPECT:4: Warning: Test: "closure" annotation takes at most one option, 2 given
diff --git a/tests/warn/invalid-element-type.h b/tests/warn/invalid-element-type.h
index 52e31164..f7e86ca4 100644
--- a/tests/warn/invalid-element-type.h
+++ b/tests/warn/invalid-element-type.h
@@ -8,8 +8,11 @@
void test_invalid_list_element_type(GList *l1, GList *l2);
-// EXPECT:5: Warning: Test: element-type annotation needs a value
-// EXPECT:5: Warning: Test: element-type takes at least one value, none given
+// EXPECT:3: Warning: Test: test_invalid_list_element_type: argument l1: Missing (element-type) annotation
+// EXPECT:3: Warning: Test: test_invalid_list_element_type: argument l2: Missing (element-type) annotation
+// EXPECT:6: Warning: Test: "element-type" annotation for a list must have exactly one option, not 2 options
+// EXPECT:5: Warning: Test: "element-type" annotation takes at least one option, none given
+// EXPECT:5: Warning: Test: "element-type" annotation for a list must have exactly one option, not 0 options
/**
* test_invalid_array_element_type:
@@ -19,8 +22,7 @@ void test_invalid_list_element_type(GList *l1, GList *l2);
void test_invalid_array_element_type(const char *a1, const char *a2);
-// EXPECT:16: Warning: Test: element-type annotation needs a value
-// EXPECT:16: Warning: Test: element-type takes at least one value, none given
+// EXPECT:19: Warning: Test: "element-type" annotation takes at least one option, none given
/**
* test_invalid_hash_element_type:
@@ -31,9 +33,9 @@ void test_invalid_array_element_type(const char *a1, const char *a2);
void test_invalid_hash_element_type(GHashTable *h1, GHashTable *h2, GHashTable *h3);
-// EXPECT:27: Warning: Test: element-type annotation needs a value
-// EXPECT:27: Warning: Test: element-type takes at least one value, none given
-// EXPECT:29: Warning: Test: element-type takes at most 2 values, 3 given
+// EXPECT:29: Warning: Test: "element-type" annotation takes at least one option, none given
+// EXPECT:29: Warning: Test: "element-type" annotation for a hash table must have exactly two options, not 0 option(s)
+// EXPECT:31: Warning: Test: "element-type" annotation takes at most 2 options, 3 given
/**
* test_invalid_bytearray_element_type:
@@ -43,8 +45,8 @@ void test_invalid_hash_element_type(GHashTable *h1, GHashTable *h2, GHashTable *
void test_invalid_bytearray_element_type(GByteArray *b1, GByteArray *b2);
-// EXPECT:40: Warning: Test: element-type annotation needs a value
-// EXPECT:40: Warning: Test: element-type takes at least one value, none given
+// EXPECT:42: Warning: Test: "element-type" annotation takes at least one option, none given
+// EXPECT:42: Warning: Test: "element-type" annotation for an array must have exactly one option, not 0 options
/**
* test_invalid_ptrarray_element_type:
@@ -54,8 +56,8 @@ void test_invalid_bytearray_element_type(GByteArray *b1, GByteArray *b2);
void test_invalid_ptrarray_element_type(GPtrArray *p1, GPtrArray *p2);
-// EXPECT:51: Warning: Test: element-type annotation needs a value
-// EXPECT:51: Warning: Test: element-type takes at least one value, none given
+// EXPECT:53: Warning: Test: "element-type" annotation takes at least one option, none given
+// EXPECT:53: Warning: Test: "element-type" annotation for an array must have exactly one option, not 0 options
/**
* test_unresolved_element_type:
@@ -65,18 +67,21 @@ void test_invalid_ptrarray_element_type(GPtrArray *p1, GPtrArray *p2);
GList* test_unresolved_element_type(void);
+/**
+ * test_unresolved_value_element_type:
+ *
+ * Returns: (element-type GLib.Value) (transfer full):
+ */
+
+GPtrArray* test_unresolved_value_element_type(void);
+
-// EXPECT:5: Warning: Test: element-type annotation takes at least one option, none given
-// EXPECT:6: Warning: Test: element-type annotation for a list must have exactly one option, not 2 options
-// EXPECT:16: Warning: Test: element-type annotation takes at least one option, none given
+// EXPECT:19: Warning: Test: Unknown container Type(target_fundamental=utf8, ctype=char*) for element-type annotation
// EXPECT:20: Warning: Test: Unknown container Type(target_fundamental=utf8, ctype=char*) for element-type annotation
-// EXPECT:27: Warning: Test: element-type annotation takes at least one option, none given
-// EXPECT:28: Warning: Test: element-type annotation for a hash table must have exactly two options, not 1 option(s)
-// EXPECT:29: Warning: Test: element-type annotation for a hash table must have exactly two options, not 3 option(s)
-// EXPECT:40: Warning: Test: element-type annotation takes at least one option, none given
-// EXPECT:41: Warning: Test: invalid (element-type) for a GByteArray, must be one of guint8, gint8 or gchar
-// EXPECT:51: Warning: Test: element-type annotation takes at least one option, none given
-// EXPECT:52: Warning: Test: invalid (element-type) for a GPtrArray, must be a pointer
-// EXPECT:63: Warning: Test: test_unresolved_element_type: Unknown type: 'Unresolved'
-// EXPECT:4: Warning: Test: test_invalid_list_element_type: argument l1: Missing (element-type) annotation
-// EXPECT:4: Warning: Test: test_invalid_list_element_type: argument l2: Missing (element-type) annotation
+// EXPECT:30: Warning: Test: "element-type" annotation for a hash table must have exactly two options, not 1 option(s)
+// EXPECT:31: Warning: Test: "element-type" annotation for a hash table must have exactly two options, not 3 option(s)
+// EXPECT:43: Warning: Test: invalid (element-type) for a GByteArray, must be one of guint8, gint8 or gchar
+// EXPECT:51: Warning: Test: test_invalid_ptrarray_element_type: argument p1: Missing (element-type) annotation
+// EXPECT:54: Warning: Test: invalid (element-type) for a GPtrArray, must be a pointer
+// EXPECT:65: Warning: Test: test_unresolved_element_type: Unknown type: 'Unresolved'
+// EXPECT:73: Warning: Test: test_unresolved_value_element_type: Unknown type: 'GLib.Value'
diff --git a/tests/warn/invalid-option.h b/tests/warn/invalid-option.h
index 41985a0e..de336eea 100644
--- a/tests/warn/invalid-option.h
+++ b/tests/warn/invalid-option.h
@@ -5,7 +5,7 @@
*/
void test_func(int param);
-// EXPECT:4: Warning: Test: invalid annotation option: invalid-annotation-option
+// EXPECT:4: Warning: Test: unknown annotation: invalid-annotation-option
/**
* func_weird_gtk_doc:
diff --git a/tests/warn/invalid-out.h b/tests/warn/invalid-out.h
index fcb4f70f..7e6ec34f 100644
--- a/tests/warn/invalid-out.h
+++ b/tests/warn/invalid-out.h
@@ -5,4 +5,4 @@
void test_invalid_out(int *out);
-// EXPECT:3: Warning: Test: out annotation value is invalid: 'invalid'
+// EXPECT:3: Warning: Test: invalid "out" annotation option: "invalid"
diff --git a/tests/warn/invalid-transfer.h b/tests/warn/invalid-transfer.h
index 3579ad15..ec43f2ac 100644
--- a/tests/warn/invalid-transfer.h
+++ b/tests/warn/invalid-transfer.h
@@ -7,6 +7,6 @@
*/
void test_transfer_invalid(int param, int param2, int param3);
-// EXPECT:4: Warning: Test: transfer annotation needs a value
-// EXPECT:5: Warning: Test: invalid transfer annotation value: 'invalid'
-// EXPECT:6: Warning: Test: transfer annotation needs one value, not 2
+// EXPECT:4: Warning: Test: "transfer" annotation needs one option, none given
+// EXPECT:5: Warning: Test: invalid "transfer" annotation option: "invalid"
+// EXPECT:6: Warning: Test: "transfer" annotation needs one option, 2 given
diff --git a/tests/warn/missing-element-type.h b/tests/warn/missing-element-type.h
index 1f958a74..87206403 100644
--- a/tests/warn/missing-element-type.h
+++ b/tests/warn/missing-element-type.h
@@ -8,3 +8,11 @@
GSList *test_gslist_element_type(void);
// EXPECT:6: Warning: Test: test_gslist_element_type: return value: Missing (element-type) annotation
+
+/**
+ * test_ptrarray_element_type:
+ * @somearray: An array.
+ */
+void test_ptrarray_arg_element_type(GPtrArray *somearray);
+
+// EXPECT:16: Warning: Test: test_ptrarray_arg_element_type: argument somearray: Missing (element-type) annotation
diff --git a/tests/warn/return-gobject.h b/tests/warn/return-gobject.h
index b6c63045..5e621c3a 100644
--- a/tests/warn/return-gobject.h
+++ b/tests/warn/return-gobject.h
@@ -10,4 +10,4 @@ GObject * test_get_object(void);
*/
GObject * test_get_object2(void);
-// EXPECT:8: Warning: Test: test_get_object2: return value: Missing (transfer) annotation
+// EXPECT:7: Warning: Test: test_get_object2: return value: Missing (transfer) annotation
diff --git a/tests/warn/unknown-parameter.h b/tests/warn/unknown-parameter.h
index 3d339b32..384704df 100644
--- a/tests/warn/unknown-parameter.h
+++ b/tests/warn/unknown-parameter.h
@@ -46,3 +46,23 @@ void test_param_missing(void);
void test_param_varargs(int i, ...);
// Should not warn
+
+/**
+ * test_undocumentable_param:
+ */
+void test_undocumentable_param(int);
+
+// EXPECT:53: Warning: Test: symbol='test_undocumentable_param': missing parameter name; undocumentable
+
+void test_undocumentable_param_2(int a, int);
+
+// EXPECT:57: Warning: Test: symbol='test_undocumentable_param_2': missing parameter name; undocumentable
+
+void test_undocumentable_param_3(int, int);
+
+// EXPECT:61: Warning: Test: symbol='test_undocumentable_param_3': missing parameter name; undocumentable
+// EXPECT:61: Warning: Test: symbol='test_undocumentable_param_3': missing parameter name; undocumentable
+
+void test_void(void);
+
+// Should not warn
diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py
index ee6b3c16..b2117910 100644
--- a/tests/warn/warningtester.py
+++ b/tests/warn/warningtester.py
@@ -10,11 +10,11 @@ sys.path.insert(0, path)
# Not correct, but enough to get the tests going uninstalled
__builtin__.__dict__['DATADIR'] = path
-from giscanner.annotationparser import AnnotationParser
+from giscanner.annotationparser import GtkDocCommentBlockParser
from giscanner.ast import Include, Namespace
from giscanner.introspectablepass import IntrospectablePass
from giscanner.maintransformer import MainTransformer
-from giscanner.message import MessageLogger
+from giscanner.message import MessageLogger, WARNING, ERROR, FATAL
from giscanner.sourcescanner import SourceScanner
from giscanner.transformer import Transformer
from giscanner.scannermain import process_packages
@@ -60,24 +60,22 @@ def _diff(a, b):
if tag == 'equal':
for line in a[i1:i2]:
for l in line.split('\n'):
- if l != '':
- retval += ' ' + l + '\n'
+ retval += ' ' + l + '\n'
continue
if tag in ('replace', 'delete'):
for line in a[i1:i2]:
for l in line.split('\n'):
- if l != '':
- retval += '-' + l + '\n'
+ retval += '-' + l + '\n'
if tag in ('replace', 'insert'):
for line in b[j1:j2]:
for l in line.split('\n'):
- if l != '':
- retval += '+' + l + '\n'
+ retval += '+' + l + '\n'
return retval
+
def _extract_expected(filename):
fd = open(filename, 'rU')
data = fd.read()
@@ -92,13 +90,14 @@ def _extract_expected(filename):
return retval
+
def check(args):
filename = args[0]
output = ChunkedIO()
namespace = Namespace('Test', '1.0')
logger = MessageLogger.get(namespace=namespace, output=output)
- logger.enable_warnings(True)
+ logger.enable_warnings((WARNING, ERROR, FATAL))
transformer = Transformer(namespace)
transformer.set_include_paths([os.path.join(top_srcdir, 'gir'), top_builddir])
@@ -115,8 +114,8 @@ def check(args):
ss.parse_macros([filename])
transformer.parse(ss.get_symbols())
- ap = AnnotationParser()
- blocks = ap.parse(ss.get_comments())
+ cbp = GtkDocCommentBlockParser()
+ blocks = cbp.parse_comment_blocks(ss.get_comments())
main = MainTransformer(transformer, blocks)
main.transform()
@@ -128,12 +127,16 @@ def check(args):
expected_warnings = _extract_expected(filename)
+ sortkey = lambda x: int(x.split(':')[0])
+ expected_warnings.sort(key=sortkey)
+ emitted_warnings.sort(key=sortkey)
+
if len(expected_warnings) != len(emitted_warnings):
raise SystemExit('ERROR in %r: %d warnings were emitted, '
- 'expected %d:\n%s' %(os.path.basename(filename),
- len(emitted_warnings),
- len(expected_warnings),
- _diff(expected_warnings, emitted_warnings)))
+ 'expected %d:\n%s' % (os.path.basename(filename),
+ len(emitted_warnings),
+ len(expected_warnings),
+ _diff(expected_warnings, emitted_warnings)))
for emitted_warning, expected_warning in zip(emitted_warnings, expected_warnings):
if expected_warning != emitted_warning: