summaryrefslogtreecommitdiff
path: root/tests/scanner/annotationparser
Commit message (Collapse)AuthorAgeFilesLines
* Revert "giscanner: don't accept (allow-none) on Returns:"Ryan Lortie2014-05-064-37/+34
| | | | | | | This reverts commit 0839e696e9fbc1942ac5c61054de3b47e9578152. This was accidentally picked up by my 'git bz apply' against the bug as I was getting ready to push the last set of changes.
* giscanner: don't accept (allow-none) on Returns:Dieter Verfaillie2014-05-064-34/+37
| | | | | | | | | The old annotationparser.py happily parsed this, but giscanner/girwriter.py never serialized an allow-none attribute to the .gir file and girepository/girparser.c never looked for an allow-none attribute either. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* tests: Update GI to use parallel test harnessSimon Feltman2014-01-041-2/+2
| | | | | | | | There was some dependence on the serial test harness in the recent tests that were added. Update GI to use the parallel test harness to avoid incompatibilities. https://bugzilla.gnome.org/show_bug.cgi?id=721477
* tests: Use Python unittest module parameterization for annotationparserSimon Feltman2013-12-291-0/+68
| | | | | | | | | | | | | | Add Python unittest module parameterization support to gi-tester through the use of a "TESTARGS" variable. Use the Automake test harness along with gi-tester for running the Python annotationparser tests. Add tests/scanner/annotationparser/Makefile.am and localize testing rules and EXTRA_DIST setup to this file. Specific Python tests can now be run as follows: cd tests/scanner/annotationparser make check TESTS=test_patterns.py TESTARGS=TestTagValueStability https://bugzilla.gnome.org/show_bug.cgi?id=720713
* tests: Refactor test_parser and test_patterns to use unittest.TestSuiteSimon Feltman2013-12-292-50/+119
| | | | | | | | | | | | | Update both test_parser.py and test_patterns.py to dynamically generate TestCase sub-classes rather than modify a statically defined one. Use unittest.TestSuite to queue up the generated test cases via the "load_tests" hook. Use underscores instead of periods as a seperator for dynamically generated test cases and methods to match Python identifiers. Beyond general cleanup, these changes will help the ability to specify Python tests individually. https://bugzilla.gnome.org/show_bug.cgi?id=720713
* tests: interesting annotationparser test caseDieter Verfaillie2013-10-091-0/+167
| | | | | | | | | GTK-Doc has trouble parsing multiline parameter description fields if the first word of a continuation line is "returns". We're already doing the right thing but make sure we continue to do so in the future https://bugzilla.gnome.org/show_bug.cgi?id=708445
* giscanner: fix c0e748e1cdf8cf0803266f94c3c5ad154df504a8Dieter Verfaillie2013-10-081-0/+2
| | | | | | | | | | | When encountering /**/ in the source, parse_gtk_doc_comment() would be executed (due to the /** part starting a GTK-Doc comment block) and would happily consume the / and everything up until the next comment block was closed or EOF, thus consuming a whole block of C code... Encoutered in the wild here: https://git.gnome.org/browse/clutter-gst/tree/clutter-gst/clutter-gst-player.c?id=03f0d8f48bd7f60e582e6185cb73a07038e8d55d#n1926
* giscanner: complain about text before the ' * 'Dieter Verfaillie2013-10-082-11/+14
| | | | | | Makes our GTK-Doc comment block rewriting tool halt on such issues, requireing user intervention instead of writing back even more bogus data.
* giscanner: write virtual method instance parameter docs to .gir fileDieter Verfaillie2013-10-081-0/+49
|
* docs: document some annotationparser.py hacking hintsDieter Verfaillie2013-10-081-11/+11
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=688897
* tests: sync with GTK-Doc test suite @ 1846fc7e904f6f56b74c366d205d6bb946eac17eDieter Verfaillie2013-10-084-9/+132
|
* giscanner: refactor GTK-Doc comment block serializationDieter Verfaillie2013-10-0855-92/+2338
|
* giscanner: add missing testsDieter Verfaillie2013-10-0820-9/+2295
|
* giscanner: make some warnings errorsDieter Verfaillie2013-10-087-12/+12
| | | | | | | GTK-Doc comment block fixer tool will refuse to rewrite source files that generated errors (indicating a source->parse tree->source would result in information being lost), but will happily continue on warnings (which do not result in information being lost).
* giscanner: honor line and paragraph breaks in description fieldsDieter Verfaillie2013-10-0813-18/+124
| | | | | | | | | GTK-Doc parameter description fields are allowed to span multiple lines, tag description fields are allowed to span multiple lines and paragraphs. A tool fixing/rewriting GTK-Doc comment blocks in source files would need to have description fields parsed and stored (almost) exactly as they appear in the source file.
* giscanner: improve state trackingDieter Verfaillie2013-10-084-67/+10
|
* giscanner: store indentation before the '*' of each lineDieter Verfaillie2013-10-081-0/+19
|
* giscanner: store code before and after comment blockDieter Verfaillie2013-10-082-58/+220
| | | | | | so we can later use them to re-write source files containing broken GTK-Doc comment blocks where /** is preceded by and/or */ is followed by code...
* giscanner: refactor annotation validationDieter Verfaillie2013-10-081-0/+32
| | | | | | | | - annotations on the identifier (formerly g-i specific tags) have never been validated before, so fix this - removes duplicate validation code from GtkDocTag and GtkDocParameter - remove repeated validation code doing the same thing as annotationparser from maintransformer...
* giscanner: give parameters their own storage classDieter Verfaillie2013-10-081-2/+2
|
* giscanner: deprecate GObject-Introspection GTK-Doc tagsDieter Verfaillie2013-10-089-69/+941
| | | | | | | | | | | | | | | | | | | | | After discussing a different issue with the GTK-Doc maintainers, we learned that our g-i specific top level tags should never have existed in the first place. The prefered notation for annotations that apply to the identifier should be written on the identifier line, for example like what we already do with (skip). As a result, this patch deprecates g-i specific top level tags and implements them as annotations on the identifier instead but still keeps support for malformed comment blocks using g-i specific top level tags. This means that all annotated code "out there" will continue to work just fine with this version of g-i, but when a developer decides to fix deprecation warnings in his/her comment blocks, the dependency on g-i needs to be raised to a version that contains at least this patch. #676133 https://bugzilla.gnome.org/show_bug.cgi?id=676133
* giscanner: flesh out annotation parsing and storageDieter Verfaillie2013-10-089-173/+556
| | | | | | | | | | - remove annotations regex, restore proper parens parsing - drop weird DocOption() storage class and use lists/dicts as appropriate - make GtkDocAnnotations a simple OrderedDict subclass instead of a weird hybrid dict/list storage class - Deprecate Attribute: tag, replace with (attributes) annotation on the identifier
* giscanner: extract tag valuesDieter Verfaillie2013-10-0821-41/+120
|
* giscanner: remove unused GtkDocCommentBlock.valueDieter Verfaillie2013-10-081-2/+2
|
* giscanner: fix GTK-Doc section parsingDieter Verfaillie2013-10-081-12/+6
|
* giscanner: fix GTK-Doc identifier parsingDieter Verfaillie2013-10-081-3/+16
| | | | | | No need to track what type of identifier we've found as we don't use that information later on. Continue searching for an identifier if it's not found on the first line like gtkdoc-mkdb does.
* giscanner: rename DocBlock to GtkDocCommentBlockDieter Verfaillie2013-10-081-2/+2
| | | | | and move it downwards after DocTag, DocOptions etc for easier reading
* giscanner: restore support for 'Return:' and 'Returns value:' tagsDieter Verfaillie2013-10-081-0/+102
| | | | | Accepted by old version of annotationparser.py and actually encountered in the wild. Internaly normalize to 'Returns:'.
* giscanner: only warn about missing delimiter when necessaryDieter Verfaillie2013-10-082-21/+0
| | | | | | | | Turns out gtkdoc-mkdb has always accepted identifier parts with and without a delimiter after the identifier_name field, so it is safe to only require it when annotations are present or in other words, when there are actually multiple fields to be seperated...
* giscanner: give message.ERROR a purposeDieter Verfaillie2013-10-081-2/+2
| | | | | | | | | | | | | | | | | | | It's not yet being used but will be in the future by annotationparser.py to signal the difference between message.WARNING: something is wrong but the comment block can still be parsed and serialized back into a comment block without information being lost message.ERROR: something is wrong and the comment block can *not* be parsed and serialized back into a comment block without information being lost Different tools can then act accordingly. Nothing will change for g-ir-scanner but this will be important for the GTK-Doc comment block rewriting tool to prevent extremely broken input leading to even more broken output...
* giscanner: complete vararg parameter parsingDieter Verfaillie2013-10-081-0/+236
| | | | | | | | | | Normalize deprecated @Varargs [1] and named __VA_ARGS__ [2] notations in as single location, add tests. Remove special casing in maintransformer as it is no longer a special case (tests/warn/unknown-parameter.h passes). [1] https://git.gnome.org/browse/gtk-doc/commit/gtkdoc-mkdb.in?id=4c9d4db0e264d403b301dad9be1c290134846d03 [1] https://git.gnome.org/browse/gtk-doc/commit/gtkdoc-mkdb.in?id=55c78181d6ae1606bdf7885e9caed70a484127ec
* giscanner: expand parse_comment_block() parametersDieter Verfaillie2013-10-081-1/+1
| | | | | Makes it consistent with the parse_comment_blocks() and _parse_comment_block() methods.
* giscanner: rename AnnotationParser() to GtkDocCommentBlockParser()Dieter Verfaillie2013-10-081-2/+2
| | | | | | Clarify the purpose of what up until now was know as the AnnotationParser() class, as it does more than just extracting annotations, it parses the complete GTK-Doc comment block.
* giscanner: rename "comment" to "description"Dieter Verfaillie2013-10-081-6/+6
| | | | Simply because they are called description fields on GTK-Doc parts...
* giscanner: rename "colon" to "delimiter"Dieter Verfaillie2013-10-081-104/+104
| | | | | | | It serves as a GTK-Doc "field" separator, so delimiter seems like a better name. This also makes the distinction between the colon used in property/signal names (which is not a "field" separator) and the GTK-Doc "field" separator a bit more clear.
* giscanner: rename "options" to "annotations"Dieter Verfaillie2013-10-081-6/+6
| | | | | | | Makes it easier to understand the difference between an annotation and an option, which are written as "(annotation option1=value1 option2=value2 ...)" in GTK-Doc comment blocks.
* tests: move GTK-Doc comment block warning testsDieter Verfaillie2013-10-0810-73/+879
| | | | | | It makes sense to let test_parser.py check everything which is focused purely on testing GTK-Doc comment blocks (ie annotationparser.py functionality).
* tests: fix diff outputDieter Verfaillie2013-10-081-6/+3
| | | | | Empty lines do get removed or added sometimes, so make sure we see those in our diff output.
* tests: test emitted GTK-Doc parser warning messagesDieter Verfaillie2013-10-085-14/+201
|
* tests: compare matched groups when testing re'sDieter Verfaillie2013-10-081-0/+8
|
* tests: remove manual validation codeDieter Verfaillie2013-10-081-5/+1
| | | | | We're already validating input .xml files so no need to duplicate this...
* tests: validate GTK-Doc test filesDieter Verfaillie2013-10-0846-90/+288
| | | | | | | | This is more of a handy developer tool than something that is always expected to be executed as part of the test suite, so we don't add a hard dependency on xmllint. https://bugzilla.gnome.org/show_bug.cgi?id=688897
* tests: put <docblock> element inside a <parser> elementDieter Verfaillie2013-10-0845-3109/+3489
| | | | | | | The <parser> element can then hold both the expected <docblock> parse tree and the warning/error messages emitted by the parser in a future <messages> child element.
* tests: rename <commentblock> element to <input>Dieter Verfaillie2013-10-0845-402/+402
| | | | | | We'll start testing parser warning/error messages and serialized output later on so this will make it easier to see what's parser input and output...
* tests: put create_tests() below TestCommentBlock()Dieter Verfaillie2013-10-081-20/+20
| | | | closer to __main__, where it's actually used...
* tests: make parsed2tree() and expected2tree() methods of TestCommentBlock()Dieter Verfaillie2013-10-081-192/+190
|
* tests: Update misc/pep8.py to 1.4.5Dieter Verfaillie2013-05-071-1/+2
| | | | | | | | | | | | | | | | | Version in our tree is a wee bit outdated. For example, later work will introduce an utf8 encoded python source file which our old pep8.py does not yet understand (yeah, it really was *that* ancient)... Updated from: https://raw.github.com/jcrocholl/pep8/1.4.5/pep8.py Takes 552c1f1525e37a30376790151c1ba437776682c5, f941537d1c0a40f0906490ed160db6c79af572d3, 5a4afe2a77d0ff7d9fea13dd93c3304a6ca993de and a17f157e19bd6792c00321c8020dca5e5a281f45 into account... https://bugzilla.gnome.org/show_bug.cgi?id=699535
* tests: add invalid identifier test caseDieter Verfaillie2013-01-091-0/+18
| | | | | | | | | | | This comment block, as found in the wild via https://bugzilla.gnome.org/show_bug.cgi?id=690850 has a couple of elements to make it an interesting test case: - a colon on the first line - stuff between parens on the first line but it still isn't a valid identifier. Add it here anyway to make sure we don't regress.
* giscanner: Don't fail on empty GTK-Doc comment blocksDieter Verfaillie2013-01-091-0/+8
| | | | | | | | | | A completely empty GTK-Doc comment block (/**\n*/) resulted in an unfriendly backtrace, complaining about an "AttributeError: 'NoneType' object has no attribute 'comment'" This fixes the issue and adds a test case. https://bugzilla.gnome.org/show_bug.cgi?id=690850
* tests/annotationparser: Drop Python API usage down to 2.6, not 2.7Colin Walters2012-12-301-8/+8
| | | | | .iterfind() is new in 2.7, but we claim 2.6 support, as I use on RHEL6.