summaryrefslogtreecommitdiff
path: root/tests/scanner/annotationparser
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2012-12-01 16:02:01 +0100
committerDieter Verfaillie <dieterv@optionexplicit.be>2012-12-02 12:28:34 +0100
commitceb84d1e084b8048b2abb81d1e1ebe600f00d00e (patch)
tree2541644084d319d3afed0f66d786c7b62ca550c3 /tests/scanner/annotationparser
parentf4bb1c1b18085ddbd22596de7f72993a2fd76c2d (diff)
downloadgobject-introspection-ceb84d1e084b8048b2abb81d1e1ebe600f00d00e.tar.gz
scanner: Parse comments with */ not on a new line, but emit a warning
We don't know how many apps do this, but at least ibus had one. https://bugzilla.gnome.org/show_bug.cgi?id=689354
Diffstat (limited to 'tests/scanner/annotationparser')
-rw-r--r--tests/scanner/annotationparser/gi/syntax.xml17
-rw-r--r--tests/scanner/annotationparser/test_patterns.py30
2 files changed, 43 insertions, 4 deletions
diff --git a/tests/scanner/annotationparser/gi/syntax.xml b/tests/scanner/annotationparser/gi/syntax.xml
index c97bd5bc..83c56b9b 100644
--- a/tests/scanner/annotationparser/gi/syntax.xml
+++ b/tests/scanner/annotationparser/gi/syntax.xml
@@ -71,23 +71,34 @@ something */</commentblock>
<test>
<!--
- Not GTK-Doc
+ Technically not GTK-Doc, but we need to support this for backwards compatibility
-->
<commentblock>/**
Test
something */</commentblock>
+ <docblock>
+ <identifier>
+ <name>Test</name>
+ </identifier>
+ <description>something</description>
+ </docblock>
</test>
<test>
<!--
- Not GTK-Doc
+ Technically not GTK-Doc, but we need to support this for backwards compatibility
-->
<commentblock>/**
Test
something **/</commentblock>
+ <docblock>
+ <identifier>
+ <name>Test</name>
+ </identifier>
+ <description>something</description>
+ </docblock>
</test>
-
<test>
<!--
Broken comment block, signal the start of the comment block description followed
diff --git a/tests/scanner/annotationparser/test_patterns.py b/tests/scanner/annotationparser/test_patterns.py
index 2755cc9a..6db99c3f 100644
--- a/tests/scanner/annotationparser/test_patterns.py
+++ b/tests/scanner/annotationparser/test_patterns.py
@@ -32,7 +32,8 @@ against the expected output.
from giscanner.annotationparser import (SECTION_RE, SYMBOL_RE, PROPERTY_RE,
- SIGNAL_RE, PARAMETER_RE, TAG_RE)
+ SIGNAL_RE, PARAMETER_RE, TAG_RE,
+ COMMENT_END_RE)
from unittest import (TestCase, main)
@@ -544,6 +545,32 @@ tag_tests = [
'colon': ':',
'description': ''})]
+comment_end_tests = [
+ (COMMENT_END_RE, '*/',
+ {'description': ''}),
+ (COMMENT_END_RE, ' */',
+ {'description': ''}),
+ (COMMENT_END_RE, ' */ ',
+ {'description': ''}),
+ (COMMENT_END_RE, '**/',
+ {'description': ''}),
+ (COMMENT_END_RE, ' **/',
+ {'description': ''}),
+ (COMMENT_END_RE, ' **/ ',
+ {'description': ''}),
+ (COMMENT_END_RE, 'test */',
+ {'description': 'test'}),
+ (COMMENT_END_RE, ' test*/',
+ {'description': 'test'}),
+ (COMMENT_END_RE, 'test **/',
+ {'description': 'test'}),
+ (COMMENT_END_RE, ' test**/',
+ {'description': 'test'}),
+ (COMMENT_END_RE, 'test *****/',
+ {'description': 'test'}),
+ (COMMENT_END_RE, ' test*****/',
+ {'description': 'test'})]
+
def create_tests(tests_name, testcases):
for (index, testcase) in enumerate(testcases):
@@ -585,6 +612,7 @@ if __name__ == '__main__':
create_tests('test_identifier_signal', identifier_signal_tests)
create_tests('test_parameter', parameter_tests)
create_tests('test_tag', tag_tests)
+ create_tests('test_comment_end', comment_end_tests)
# Run test suite
main()