summaryrefslogtreecommitdiff
path: root/tests/scanner/annotationparser
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2020-04-08 14:00:51 +0100
committerEmmanuele Bassi <ebassi@gmail.com>2020-04-24 14:18:08 +0000
commit9cb1ac54f5cda256230e76d4d78e960f98c9d2c3 (patch)
treed0c468b0e19ba086471e7bb11592d3fa45e522d0 /tests/scanner/annotationparser
parentec08670d80d12668e3e6be4b6eb395e5ad207034 (diff)
downloadgobject-introspection-9cb1ac54f5cda256230e76d4d78e960f98c9d2c3.tar.gz
Support the gtk-doc action syntax
GTK4 allows adding widget-related actions to the documentation with the newly defined syntax: <class_name> '|' <action_name> ':' This means g-ir-scanner needs to detect this new format, to avoid emitting unnecessary warnings. Currently, we don't do anything with the actions; in the future we might want to add them to the documentation in the GIR, but for that we'd need a new element. See also: GNOME/gtk-doc!30
Diffstat (limited to 'tests/scanner/annotationparser')
-rw-r--r--tests/scanner/annotationparser/test_patterns.py154
1 files changed, 153 insertions, 1 deletions
diff --git a/tests/scanner/annotationparser/test_patterns.py b/tests/scanner/annotationparser/test_patterns.py
index 131d6282..68db9870 100644
--- a/tests/scanner/annotationparser/test_patterns.py
+++ b/tests/scanner/annotationparser/test_patterns.py
@@ -33,7 +33,7 @@ import unittest
from giscanner.annotationparser import (COMMENT_BLOCK_START_RE, COMMENT_BLOCK_END_RE,
COMMENT_ASTERISK_RE, INDENTATION_RE, EMPTY_LINE_RE,
- SECTION_RE, SYMBOL_RE, PROPERTY_RE,
+ SECTION_RE, SYMBOL_RE, PROPERTY_RE, ACTION_RE,
SIGNAL_RE, PARAMETER_RE, TAG_RE,
TAG_VALUE_VERSION_RE, TAG_VALUE_STABILITY_RE)
@@ -663,6 +663,157 @@ identifier_signal_tests = [
'delimiter': ':',
'fields': '(type GLib.List(GLib.List(utf8))) (transfer full)'})]
+identifier_action_tests = [
+ (ACTION_RE, 'GtkWidget|group.action (skip)',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': '(skip)'}),
+ (ACTION_RE, 'GtkWidget|group.action',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget |group.action',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget| group.action ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget | group.action ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget|group.action:',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget|group.action: ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget|group.action:',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Something|group.action:',
+ {'class_name': 'Something',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Something|group.action: ',
+ {'class_name': 'Something',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, ' Something|group.action:',
+ {'class_name': 'Something',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Weird-thing|name:',
+ None),
+ (ACTION_RE, 'really-weird_thing|name:',
+ None),
+ (ACTION_RE, 'GWin32InputStream|group.action:',
+ {'class_name': 'GWin32InputStream',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ # properties: action name that contains a dash
+ (ACTION_RE, 'GtkWidget|group.double-buffered (skip)',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': '(skip)'}),
+ (ACTION_RE, 'GtkWidget|group.double-buffered',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget |group.double-buffered',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget| group.double-buffered ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget | group.double-buffered ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget|group.double-buffered:',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget|group.double-buffered: ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget|group.double-buffered:',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Something|group.double-buffered:',
+ {'class_name': 'Something',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Something|group.double-buffered: ',
+ {'class_name': 'Something',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, ' Something|group.double-buffered:',
+ {'class_name': 'Something',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Weird-thing|double-buffered:',
+ None),
+ (ACTION_RE, 'really-weird_thing|double-buffered:',
+ None),
+ (ACTION_RE, ' GMemoryOutputStream|group.realloc-function: (skip)',
+ {'class_name': 'GMemoryOutputStream',
+ 'action_name': 'group.realloc-function',
+ 'delimiter': ':',
+ 'fields': '(skip)'}),
+ (ACTION_RE, 'Something|group-double.double-buffered',
+ {'class_name': 'Something',
+ 'action_name': 'group-double.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'Something| group-double.double-buffered',
+ {'class_name': 'Something',
+ 'action_name': 'group-double.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'Something |group-double.double-buffered',
+ {'class_name': 'Something',
+ 'action_name': 'group-double.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'Something | group-double.double-buffered',
+ {'class_name': 'Something',
+ 'action_name': 'group-double.double-buffered',
+ 'delimiter': '',
+ 'fields': ''})]
+
parameter_tests = [
(PARAMETER_RE, '@Short_description: Base class for all widgets ',
{'parameter_name': 'Short_description',
@@ -908,6 +1059,7 @@ def create_test_cases():
('TestIdentifierSymbol', identifier_symbol_tests),
('TestIdentifierProperty', identifier_property_tests),
('TestIdentifierSignal', identifier_signal_tests),
+ ('TestIdentifierAction', identifier_action_tests),
('TestParameter', parameter_tests),
('TestTag', tag_tests),
('TestTagValueVersion', tag_value_version_tests),