summaryrefslogtreecommitdiff
path: root/tests/scanner
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scanner')
-rw-r--r--tests/scanner/annotationparser/test_patterns.py154
-rw-r--r--tests/scanner/meson.build40
2 files changed, 173 insertions, 21 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),
diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build
index 50ca5a2b..fa7f7eca 100644
--- a/tests/scanner/meson.build
+++ b/tests/scanner/meson.build
@@ -106,7 +106,7 @@ python_path = run_command(python, ['-c', 'import sys; sys.stdout.write(sys.execu
gircompiler_command = [
gircompiler, '-o', '@OUTPUT@', '@INPUT@',
- '--includedir', join_paths(meson.build_root(), 'gir'),
+ '--includedir', join_paths(build_root, 'gir'),
'--includedir', meson.current_build_dir(),
]
@@ -122,8 +122,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=Typedefs',
@@ -162,8 +162,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=Bar',
@@ -173,7 +173,7 @@ if glib_dep.type_name() == 'pkgconfig'
'--library=barapp-1.0',
'--accept-unprefixed',
'-L', meson.current_build_dir(),
- '-L', join_paths(meson.build_root(), 'girepository'),
+ '-L', join_paths(build_root, 'girepository'),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
extra_giscanner_args,
@@ -201,8 +201,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=SLetter',
@@ -239,8 +239,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--namespace=WarnLib',
'--nsversion=1.0',
'--include=Gio-2.0',
@@ -275,8 +275,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=Utility',
@@ -313,8 +313,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=GtkFrob',
@@ -352,8 +352,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--namespace=GetType',
'--nsversion=1.0',
'--identifier-prefix=GetType',
@@ -483,8 +483,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--add-include-path', meson.current_build_dir(),
'--namespace=Regress',
'--nsversion=1.0',
@@ -542,7 +542,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
output: 'Regress-1.0-' + language,
command: [
python, girdoctool,
- '--add-include-path=' + join_paths(meson.build_root(), 'gir'),
+ '--add-include-path=' + join_paths(build_root, 'gir'),
'--add-include-path=' + meson.current_build_dir(),
'--language', language,
'@INPUT@', '-o', '@OUTPUT@'],
@@ -570,7 +570,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
output: 'Regress-1.0-sections.txt',
command: [
python, girdoctool,
- '--add-include-path=' + join_paths(meson.build_root(), 'gir'),
+ '--add-include-path=' + join_paths(build_root, 'gir'),
'--add-include-path=' + meson.current_build_dir(),
'--write-sections-file',
'@INPUT@', '-o', '@OUTPUT@'],