[vala/wip/tests-split: 4/4] tests: Split up gir parser tests into dedicated files
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/tests-split: 4/4] tests: Split up gir parser tests into dedicated files
- Date: Thu, 9 Jun 2022 12:38:10 +0000 (UTC)
commit 8d12373dc324736fda530f67f6c01c8d49cc343f
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed May 25 16:48:51 2022 +0200
tests: Split up gir parser tests into dedicated files
build-aux/testrunner.sh | 39 +++---------
tests/Makefile.am | 71 +++++++++++-----------
tests/gir/alias.gir | 13 ++++
tests/gir/alias.test | 14 -----
tests/gir/alias.vapi-expected | 7 +++
...ay-fixed-length.test => array-fixed-length.gir} | 25 +++-----
tests/gir/array-fixed-length.vapi-expected | 11 ++++
...ation-method.test => async-creation-method.gir} | 22 +++----
tests/gir/async-creation-method.vapi-expected | 8 +++
...{async-result-pos.test => async-result-pos.gir} | 24 +++-----
tests/gir/async-result-pos.vapi-expected | 10 +++
.../{async-sync-out.test => async-sync-out.gir} | 23 +++----
tests/gir/async-sync-out.vapi-expected | 9 +++
tests/gir/bug651773.gir | 25 ++++++++
tests/gir/bug651773.test | 24 --------
tests/gir/bug651773.vapi-expected | 5 ++
tests/gir/{bug667751.test => bug667751.gir} | 21 +++----
tests/gir/bug667751.vapi-expected | 7 +++
tests/gir/{bug742012.test => bug742012.gir} | 31 +++-------
tests/gir/bug742012.vapi-expected | 17 ++++++
tests/gir/{bug788775.test => bug788775.gir} | 19 +++---
tests/gir/bug788775.vapi-expected | 5 ++
tests/gir/{bug792998.test => bug792998.gir} | 30 +++------
tests/gir/bug792998.vapi-expected | 16 +++++
tests/gir/{class-final.test => class-final.gir} | 27 +++-----
tests/gir/class-final.vapi-expected | 13 ++++
tests/gir/{class.test => class.gir} | 42 +++----------
tests/gir/class.vapi-expected | 28 +++++++++
tests/gir/constant.gir | 21 +++++++
tests/gir/constant.test | 22 -------
tests/gir/constant.vapi-expected | 7 +++
tests/gir/delegate-alias-without-target.gir | 19 ++++++
tests/gir/delegate-alias-without-target.test | 20 ------
.../delegate-alias-without-target.vapi-expected | 7 +++
...egate-anonymous.test => delegate-anonymous.gir} | 23 +++----
tests/gir/delegate-anonymous.vapi-expected | 9 +++
...th-type.test => delegate-array-length-type.gir} | 19 +++---
tests/gir/delegate-array-length-type.vapi-expected | 5 ++
...=> delegate-closure-destroy-index-conflict.gir} | 26 +++-----
...te-closure-destroy-index-conflict.vapi-expected | 12 ++++
...egate-error-pos.test => delegate-error-pos.gir} | 19 +++---
tests/gir/delegate-error-pos.vapi-expected | 5 ++
tests/gir/{enum.test => enum.gir} | 39 +++---------
tests/gir/enum.vapi-expected | 25 ++++++++
tests/gir/{errordomain.test => errordomain.gir} | 27 +++-----
tests/gir/errordomain.vapi-expected | 13 ++++
...type-struct-name.test => gtype-struct-name.gir} | 25 +++-----
tests/gir/gtype-struct-name.vapi-expected | 11 ++++
...ter-owned.test => instance-parameter-owned.gir} | 27 +++-----
tests/gir/instance-parameter-owned.vapi-expected | 13 ++++
tests/gir/method-array-length-type.gir | 22 +++++++
tests/gir/method-array-length-type.test | 21 -------
tests/gir/method-array-length-type.vapi-expected | 5 ++
tests/gir/{method-class.test => method-class.gir} | 24 +++-----
tests/gir/method-class.vapi-expected | 10 +++
...{method-nowrapper.test => method-nowrapper.gir} | 24 +++-----
tests/gir/method-nowrapper.vapi-expected | 10 +++
tests/gir/parameter-array-length-type.gir | 25 ++++++++
tests/gir/parameter-array-length-type.test | 24 --------
.../gir/parameter-array-length-type.vapi-expected | 5 ++
tests/gir/parameter-nullable-out-simple-type.gir | 20 ++++++
tests/gir/parameter-nullable-out-simple-type.test | 19 ------
...arameter-nullable-out-simple-type.vapi-expected | 5 ++
tests/gir/property-non-readable.gir | 16 +++++
tests/gir/property-non-readable.test | 20 ------
tests/gir/property-non-readable.vapi-expected | 10 +++
.../{signal-virtual.test => signal-virtual.gir} | 23 +++----
tests/gir/signal-virtual.vapi-expected | 9 +++
tests/gir/symbol-redefined.gir | 25 ++++++++
tests/gir/symbol-redefined.test | 27 --------
tests/gir/symbol-redefined.vapi-expected | 8 +++
...l-type-csuffix.test => symbol-type-csuffix.gir} | 24 +++-----
tests/gir/symbol-type-csuffix.vapi-expected | 10 +++
tests/gir/symbol-without-name.gir | 20 ++++++
tests/gir/symbol-without-name.test | 19 ------
tests/gir/symbol-without-name.vapi-expected | 5 ++
tests/gir/union-transparent.gir | 27 ++++++++
tests/gir/union-transparent.test | 30 ---------
tests/gir/union-transparent.vapi-expected | 9 +++
tests/gir/union.gir | 18 ++++++
tests/gir/union.test | 20 ------
tests/gir/union.vapi-expected | 8 +++
82 files changed, 851 insertions(+), 671 deletions(-)
---
diff --git a/build-aux/testrunner.sh b/build-aux/testrunner.sh
index 967a06238..c21c4dfd8 100755
--- a/build-aux/testrunner.sh
+++ b/build-aux/testrunner.sh
@@ -79,8 +79,6 @@ function testheader() {
elif [ "$1" = "D-Bus" ]; then
DBUSTEST=1
run_prefix="dbus-run-session -- $run_prefix"
- elif [ "$1" = "GIR" ]; then
- GIRTEST=1
elif [ "$1" = "GIRWriter" ]; then
GIRWRITERTEST=1
fi
@@ -96,28 +94,6 @@ function sourceheader() {
ns=${ns//-/_}
SOURCEFILE=$ns.vala
SOURCEFILES="$SOURCEFILES $SOURCEFILE"
- elif [ $GIRTEST -eq 1 ]; then
- if [ "$1" = "Input:" ]; then
- ns=$testpath
- SOURCEFILE=$ns.gir
- cat <<EOF > $SOURCEFILE
-<?xml version="1.0"?>
-<repository version="1.2"
- xmlns="http://www.gtk.org/introspection/core/1.0"
- xmlns:c="http://www.gtk.org/introspection/c/1.0"
- xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
- <include name="GLib" version="2.0"/>
- <include name="GObject" version="2.0"/>
- <include name="Gio" version="2.0"/>
- <c:include name="test.h"/>
- <namespace name="Test"
- version="1.2"
- c:identifier-prefixes="Test"
- c:symbol-prefixes="test">
-EOF
- elif [ "$1" = "Output:" ]; then
- SOURCEFILE=$testpath.vapi.ref
- fi
elif [ $GIRWRITERTEST -eq 1 ]; then
if [ "$1" = "Input:" ]; then
ns=$testpath
@@ -140,13 +116,6 @@ function sourceend() {
echo "RET=\$?" >> check
echo "if [ \$RET -ne 1 ]; then exit 1; fi" >> check
echo "exit 0" >> check
- elif [ $GIRTEST -eq 1 ]; then
- if [ $PART -eq 1 ]; then
- echo " </namespace>" >> $SOURCEFILE
- echo "</repository>" >> $SOURCEFILE
- fi
- PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg")
- echo "$VAPIGEN $VAPIGENFLAGS $PACKAGEFLAGS --library $ns $ns.gir && tail -n +5 $ns.vapi|sed
'\$d'|diff -wu $ns.vapi.ref -" > check
elif [ $GIRWRITERTEST -eq 1 ]; then
if [ $PART -eq 1 ]; then
echo "}" >> $SOURCEFILE
@@ -203,6 +172,13 @@ case "$testfile" in
fi
./$testpath$EXEEXT
;;
+*.gir)
+ SOURCEFILE=$testpath.gir
+ cat "$abs_srcdir/$testfile" > ./$SOURCEFILE
+ PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg")
+ $VAPIGEN $VAPIGENFLAGS $PACKAGEFLAGS --library $testpath $SOURCEFILE || exit 1
+ tail -n +3 ${SOURCEFILE%.*}.vapi | diff -wu $abs_srcdir/${testfile%.*}.vapi-expected - || exit 1
+ ;;
*.test)
rm -f prepare check
echo 'set -e' >> prepare
@@ -210,7 +186,6 @@ case "$testfile" in
PART=0
INHEADER=1
INVALIDCODE=0
- GIRTEST=0
GIRWRITERTEST=0
DBUSTEST=0
ISSERVER=0
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3dd2cad45..7fdfcb1dc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -18,11 +18,12 @@ BUILT_SOURCES = \
noinst_PROGRAMS = \
$(NULL)
-TEST_EXTENSIONS = .vala .gs .test
+TEST_EXTENSIONS = .vala .gs .gir .test
TEST_RUNNER = $(abs_top_srcdir)/build-aux/testrunner.sh
VALA_LOG_COMPILER = $(TEST_RUNNER)
GS_LOG_COMPILER = $(TEST_RUNNER)
+GIR_LOG_COMPILER = $(TEST_RUNNER)
TEST_LOG_COMPILER = $(TEST_RUNNER)
AM_TESTS_ENVIRONMENT = \
@@ -825,40 +826,40 @@ TESTS = \
dbus/bug792277.vala \
dbus/rawvariants.test \
dbus/interface-info.test \
- gir/bug651773.test \
- gir/bug667751.test \
- gir/bug742012.test \
- gir/bug788775.test \
- gir/bug792998.test \
- gir/alias.test \
- gir/array-fixed-length.test \
- gir/async-creation-method.test \
- gir/async-result-pos.test \
- gir/async-sync-out.test \
- gir/class.test \
- gir/class-final.test \
- gir/constant.test \
- gir/delegate-alias-without-target.test \
- gir/delegate-anonymous.test \
- gir/delegate-array-length-type.test \
- gir/delegate-closure-destroy-index-conflict.test \
- gir/delegate-error-pos.test \
- gir/enum.test \
- gir/errordomain.test \
- gir/gtype-struct-name.test \
- gir/instance-parameter-owned.test \
- gir/method-array-length-type.test \
- gir/method-class.test \
- gir/method-nowrapper.test \
- gir/parameter-array-length-type.test \
- gir/parameter-nullable-out-simple-type.test \
- gir/property-non-readable.test \
- gir/signal-virtual.test \
- gir/symbol-redefined.test \
- gir/symbol-type-csuffix.test \
- gir/symbol-without-name.test \
- gir/union.test \
- gir/union-transparent.test \
+ gir/bug651773.gir \
+ gir/bug667751.gir \
+ gir/bug742012.gir \
+ gir/bug788775.gir \
+ gir/bug792998.gir \
+ gir/alias.gir \
+ gir/array-fixed-length.gir \
+ gir/async-creation-method.gir \
+ gir/async-result-pos.gir \
+ gir/async-sync-out.gir \
+ gir/class.gir \
+ gir/class-final.gir \
+ gir/constant.gir \
+ gir/delegate-alias-without-target.gir \
+ gir/delegate-anonymous.gir \
+ gir/delegate-array-length-type.gir \
+ gir/delegate-closure-destroy-index-conflict.gir \
+ gir/delegate-error-pos.gir \
+ gir/enum.gir \
+ gir/errordomain.gir \
+ gir/gtype-struct-name.gir \
+ gir/instance-parameter-owned.gir \
+ gir/method-array-length-type.gir \
+ gir/method-class.gir \
+ gir/method-nowrapper.gir \
+ gir/parameter-array-length-type.gir \
+ gir/parameter-nullable-out-simple-type.gir \
+ gir/property-non-readable.gir \
+ gir/signal-virtual.gir \
+ gir/symbol-redefined.gir \
+ gir/symbol-type-csuffix.gir \
+ gir/symbol-without-name.gir \
+ gir/union.gir \
+ gir/union-transparent.gir \
girwriter/class-final.test \
girwriter/combined.test \
gtktemplate/gtkcallback-incompatible.test \
diff --git a/tests/gir/alias.gir b/tests/gir/alias.gir
new file mode 100644
index 000000000..619fa3aec
--- /dev/null
+++ b/tests/gir/alias.gir
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<alias name="Foo" c:type="TestFoo">
+ <type name="gint" c:type="int"/>
+</alias>
+</namespace>
+</repository>
diff --git a/tests/gir/alias.vapi-expected b/tests/gir/alias.vapi-expected
new file mode 100644
index 000000000..40cb13988
--- /dev/null
+++ b/tests/gir/alias.vapi-expected
@@ -0,0 +1,7 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h")]
+ [SimpleType]
+ public struct Foo : int {
+ }
+}
diff --git a/tests/gir/array-fixed-length.test b/tests/gir/array-fixed-length.gir
similarity index 78%
rename from tests/gir/array-fixed-length.test
rename to tests/gir/array-fixed-length.gir
index d4ea0175d..157f46cdb 100644
--- a/tests/gir/array-fixed-length.test
+++ b/tests/gir/array-fixed-length.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<function name="get_array_return" c:identifier="test_get_array_return">
<return-value transfer-ownership="none">
<array zero-terminated="0" c:type="gpointer*" fixed-size="16">
@@ -55,14 +59,5 @@ Input:
</parameter>
</parameters>
</function>
-
-Output:
-
-[CCode (cheader_filename = "test.h")]
-public static void change_array ([CCode (array_length = false)] ref uint8 array[2]);
-[CCode (cheader_filename = "test.h")]
-public static void get_array_out ([CCode (array_length = false)] out uint8 array[8]);
-[CCode (array_length = false, array_length_cexpr = "16", cheader_filename = "test.h")]
-public static unowned uint8[] get_array_return ();
-[CCode (cheader_filename = "test.h")]
-public static void set_array ([CCode (array_length = false)] uint8 array[4]);
+</namespace>
+</repository>
diff --git a/tests/gir/array-fixed-length.vapi-expected b/tests/gir/array-fixed-length.vapi-expected
new file mode 100644
index 000000000..19f0b5723
--- /dev/null
+++ b/tests/gir/array-fixed-length.vapi-expected
@@ -0,0 +1,11 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h")]
+ public static void change_array ([CCode (array_length = false)] ref uint8 array[2]);
+ [CCode (cheader_filename = "test.h")]
+ public static void get_array_out ([CCode (array_length = false)] out uint8 array[8]);
+ [CCode (array_length = false, array_length_cexpr = "16", cheader_filename = "test.h")]
+ public static unowned uint8[] get_array_return ();
+ [CCode (cheader_filename = "test.h")]
+ public static void set_array ([CCode (array_length = false)] uint8 array[4]);
+}
diff --git a/tests/gir/async-creation-method.test b/tests/gir/async-creation-method.gir
similarity index 78%
rename from tests/gir/async-creation-method.test
rename to tests/gir/async-creation-method.gir
index fccafb0b8..86096bdc2 100644
--- a/tests/gir/async-creation-method.test
+++ b/tests/gir/async-creation-method.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="Foo"
c:symbol-prefix="foo"
c:type="TestFoo"
@@ -60,11 +64,5 @@ Input:
<type name="GObject.ObjectClass" c:type="GObjectClass"/>
</field>
</record>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class Foo : GLib.Object {
- [CCode (cname = "test_foo_new_async", has_construct_function = false)]
- public async Foo (GLib.Cancellable? cancellable) throws GLib.Error;
-}
+</namespace>
+</repository>
diff --git a/tests/gir/async-creation-method.vapi-expected b/tests/gir/async-creation-method.vapi-expected
new file mode 100644
index 000000000..32edcb498
--- /dev/null
+++ b/tests/gir/async-creation-method.vapi-expected
@@ -0,0 +1,8 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Foo : GLib.Object {
+ [CCode (cname = "test_foo_new_async", has_construct_function = false)]
+ public async Foo (GLib.Cancellable? cancellable) throws GLib.Error;
+ }
+}
diff --git a/tests/gir/async-result-pos.test b/tests/gir/async-result-pos.gir
similarity index 77%
rename from tests/gir/async-result-pos.test
rename to tests/gir/async-result-pos.gir
index 2a17f53dc..9e0a8d903 100644
--- a/tests/gir/async-result-pos.test
+++ b/tests/gir/async-result-pos.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="Foo" c:type="TestFoo" glib:type-name="TestFoo" glib:get-type="test_foo_get_type"
glib:type-struct="FooClass" parent="GObject.Object">
<method name="method_async" c:identifier="test_foo_method_async">
<return-value transfer-ownership="none">
@@ -44,13 +48,5 @@ Input:
</return-value>
</constructor>
</class>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class Foo : GLib.Object {
- [CCode (has_construct_function = false)]
- public Foo ();
- [CCode (async_result_pos = 2.1)]
- public async void method_async (string input, out string output) throws GLib.Error;
-}
+</namespace>
+</repository>
diff --git a/tests/gir/async-result-pos.vapi-expected b/tests/gir/async-result-pos.vapi-expected
new file mode 100644
index 000000000..f0757a9c8
--- /dev/null
+++ b/tests/gir/async-result-pos.vapi-expected
@@ -0,0 +1,10 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public Foo ();
+ [CCode (async_result_pos = 2.1)]
+ public async void method_async (string input, out string output) throws GLib.Error;
+ }
+}
diff --git a/tests/gir/async-sync-out.test b/tests/gir/async-sync-out.gir
similarity index 78%
rename from tests/gir/async-sync-out.test
rename to tests/gir/async-sync-out.gir
index 48956f61d..886081e67 100644
--- a/tests/gir/async-sync-out.test
+++ b/tests/gir/async-sync-out.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="Foo" c:type="TestFoo" glib:type-name="TestFoo" glib:get-type="test_foo_get_type"
glib:type-struct="FooClass" parent="GObject.Object">
<method name="method_async" c:identifier="test_foo_method_async">
<return-value transfer-ownership="none">
@@ -47,12 +51,5 @@ Input:
</return-value>
</constructor>
</class>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class Foo : GLib.Object {
- [CCode (has_construct_function = false)]
- public Foo ();
- public async void method_async (string input, string* sync_output, out string output) throws
GLib.Error;
-}
+</namespace>
+</repository>
diff --git a/tests/gir/async-sync-out.vapi-expected b/tests/gir/async-sync-out.vapi-expected
new file mode 100644
index 000000000..086271360
--- /dev/null
+++ b/tests/gir/async-sync-out.vapi-expected
@@ -0,0 +1,9 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public Foo ();
+ public async void method_async (string input, string* sync_output, out string output) throws
GLib.Error;
+ }
+}
diff --git a/tests/gir/bug651773.gir b/tests/gir/bug651773.gir
new file mode 100644
index 000000000..42760371e
--- /dev/null
+++ b/tests/gir/bug651773.gir
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<function name="get_array" c:identifier="test_get_array">
+ <return-value transfer-ownership="none">
+ <array length="0" c:type="guchar*">
+ <type name="guint8" c:type="guchar"/>
+ </array>
+ </return-value>
+ <parameters>
+ <parameter name="len"
+ direction="out"
+ caller-allocates="1"
+ transfer-ownership="full">
+ <type name="gsize" c:type="gsize*"/>
+ </parameter>
+ </parameters>
+</function>
+</namespace>
+</repository>
diff --git a/tests/gir/bug651773.vapi-expected b/tests/gir/bug651773.vapi-expected
new file mode 100644
index 000000000..fe3848052
--- /dev/null
+++ b/tests/gir/bug651773.vapi-expected
@@ -0,0 +1,5 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (array_length_pos = 0.1, array_length_type = "gsize", cheader_filename = "test.h")]
+ public static unowned uint8[] get_array ();
+}
diff --git a/tests/gir/bug667751.test b/tests/gir/bug667751.gir
similarity index 60%
rename from tests/gir/bug667751.test
rename to tests/gir/bug667751.gir
index dfba91609..e610ec1e9 100644
--- a/tests/gir/bug667751.test
+++ b/tests/gir/bug667751.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<alias name="RemoteConnectionCommitFunc"
c:type="NMRemoteConnectionCommitFunc">
<type name="RemoteConnectionResultFunc"
@@ -24,10 +28,5 @@ Input:
</parameter>
</parameters>
</callback>
-
-Output:
-
-[CCode (cheader_filename = "test.h", cname = "NMRemoteConnectionResultFunc", instance_pos = 1.9)]
-public delegate void RemoteConnectionCommitFunc (GLib.Error error);
-[CCode (cheader_filename = "test.h", cname = "NMRemoteConnectionResultFunc", instance_pos = 1.9)]
-public delegate void RemoteConnectionResultFunc (GLib.Error error);
+</namespace>
+</repository>
diff --git a/tests/gir/bug667751.vapi-expected b/tests/gir/bug667751.vapi-expected
new file mode 100644
index 000000000..f9dcdaaa3
--- /dev/null
+++ b/tests/gir/bug667751.vapi-expected
@@ -0,0 +1,7 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", cname = "NMRemoteConnectionResultFunc", instance_pos = 1.9)]
+ public delegate void RemoteConnectionCommitFunc (GLib.Error error);
+ [CCode (cheader_filename = "test.h", cname = "NMRemoteConnectionResultFunc", instance_pos = 1.9)]
+ public delegate void RemoteConnectionResultFunc (GLib.Error error);
+}
diff --git a/tests/gir/bug742012.test b/tests/gir/bug742012.gir
similarity index 78%
rename from tests/gir/bug742012.test
rename to tests/gir/bug742012.gir
index 5ce77a6b3..221bcbfcf 100644
--- a/tests/gir/bug742012.test
+++ b/tests/gir/bug742012.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="CertificateRenderer"
c:symbol-prefix="certificate_renderer"
c:type="GcrCertificateRenderer"
@@ -76,20 +80,5 @@ Input:
<type name="GObject.TypeInterface" c:type="GTypeInterface"/>
</field>
</record>
-
-Output:
-
-[CCode (cheader_filename = "test.h", cname = "GcrCertificateRenderer", type_id =
"gcr_certificate_renderer_get_type ()")]
-public class CertificateRenderer : GLib.Object, Test.Renderer {
- [CCode (has_construct_function = false)]
- protected CertificateRenderer ();
-}
-[CCode (cheader_filename = "test.h", cname = "GcrRenderer", type_id = "gcr_renderer_get_type ()")]
-public interface Renderer : GLib.Object {
- [CCode (cname = "gcr_renderer_get_attributes")]
- public unowned GLib.List get_attributes ();
- [CCode (cname = "gcr_renderer_set_attributes")]
- public void set_attributes (GLib.List? attrs);
- [NoAccessorMethod]
- public abstract GLib.List attributes { owned get; set; }
-}
+</namespace>
+</repository>
diff --git a/tests/gir/bug742012.vapi-expected b/tests/gir/bug742012.vapi-expected
new file mode 100644
index 000000000..a5a61d2af
--- /dev/null
+++ b/tests/gir/bug742012.vapi-expected
@@ -0,0 +1,17 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", cname = "GcrCertificateRenderer", type_id =
"gcr_certificate_renderer_get_type ()")]
+ public class CertificateRenderer : GLib.Object, Test.Renderer {
+ [CCode (has_construct_function = false)]
+ protected CertificateRenderer ();
+ }
+ [CCode (cheader_filename = "test.h", cname = "GcrRenderer", type_id = "gcr_renderer_get_type ()")]
+ public interface Renderer : GLib.Object {
+ [CCode (cname = "gcr_renderer_get_attributes")]
+ public unowned GLib.List get_attributes ();
+ [CCode (cname = "gcr_renderer_set_attributes")]
+ public void set_attributes (GLib.List? attrs);
+ [NoAccessorMethod]
+ public abstract GLib.List attributes { owned get; set; }
+ }
+}
diff --git a/tests/gir/bug788775.test b/tests/gir/bug788775.gir
similarity index 59%
rename from tests/gir/bug788775.test
rename to tests/gir/bug788775.gir
index 80ae7cd21..0665e47e8 100644
--- a/tests/gir/bug788775.test
+++ b/tests/gir/bug788775.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<function name="get_string_list" c:identifier="test_get_string_list">
<return-value transfer-ownership="full">
<array length="1" zero-terminated="1" c:type="gchar**">
@@ -22,8 +26,5 @@ Input:
</parameter>
</parameters>
</function>
-
-Output:
-
-[CCode (array_length = true, array_length_pos = 1.1, array_length_type = "gsize", array_null_terminated =
true, cheader_filename = "test.h")]
-public static string[] get_string_list (string key);
+</namespace>
+</repository>
diff --git a/tests/gir/bug788775.vapi-expected b/tests/gir/bug788775.vapi-expected
new file mode 100644
index 000000000..aaeaa90df
--- /dev/null
+++ b/tests/gir/bug788775.vapi-expected
@@ -0,0 +1,5 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (array_length = true, array_length_pos = 1.1, array_length_type = "gsize",
array_null_terminated = true, cheader_filename = "test.h")]
+ public static string[] get_string_list (string key);
+}
diff --git a/tests/gir/bug792998.test b/tests/gir/bug792998.gir
similarity index 73%
rename from tests/gir/bug792998.test
rename to tests/gir/bug792998.gir
index ca4b18ac1..7babd77d2 100644
--- a/tests/gir/bug792998.test
+++ b/tests/gir/bug792998.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="Foo" c:type="TestFoo" glib:type-name="TestFoo" glib:get-type="test_foo_get_type"
glib:type-struct="FooClass" parent="GObject.Object">
<method name="get_prop1" c:identifier="test_foo_get_prop1" throws="1">
<return-value transfer-ownership="full">
@@ -41,19 +45,5 @@ Input:
</method>
</class>
<record name="FooClass" c:type="TestFooClass" glib:is-gtype-struct-for="Foo"/>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class Foo : GLib.Object {
- [CCode (has_construct_function = false)]
- protected Foo ();
- public int get_prop1 () throws GLib.Error;
- public int get_prop2 ();
- public void set_prop1 (int value);
- public bool set_prop2 (int i) throws GLib.Error;
- [NoAccessorMethod]
- public int prop1 { get; set; }
- [NoAccessorMethod]
- public int prop2 { get; set; }
-}
+</namespace>
+</repository>
diff --git a/tests/gir/bug792998.vapi-expected b/tests/gir/bug792998.vapi-expected
new file mode 100644
index 000000000..cbad85122
--- /dev/null
+++ b/tests/gir/bug792998.vapi-expected
@@ -0,0 +1,16 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Foo ();
+ public int get_prop1 () throws GLib.Error;
+ public int get_prop2 ();
+ public void set_prop1 (int value);
+ public bool set_prop2 (int i) throws GLib.Error;
+ [NoAccessorMethod]
+ public int prop1 { get; set; }
+ [NoAccessorMethod]
+ public int prop2 { get; set; }
+ }
+}
diff --git a/tests/gir/class-final.test b/tests/gir/class-final.gir
similarity index 54%
rename from tests/gir/class-final.test
rename to tests/gir/class-final.gir
index 51449f3f0..fab7490d3 100644
--- a/tests/gir/class-final.test
+++ b/tests/gir/class-final.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="Foo" c:type="TestFoo" glib:type-name="TestFoo" glib:get-type="test_foo_get_type"
glib:type-struct="FooClass" parent="GObject.Object">
</class>
<record name="FooClass" c:type="TestFooClass" glib:is-gtype-struct-for="Foo">
@@ -12,16 +16,5 @@ Input:
<record name="BarClass" c:type="TestBarClass" glib:is-gtype-struct-for="Bar">
</record>
<record name="BarPrivate" c:type="TestBarPrivate" disguised="1"/>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_bar_get_type ()")]
-public sealed class Bar : Test.Foo {
- [CCode (has_construct_function = false)]
- protected Bar ();
-}
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class Foo : GLib.Object {
- [CCode (has_construct_function = false)]
- protected Foo ();
-}
+</namespace>
+</repository>
diff --git a/tests/gir/class-final.vapi-expected b/tests/gir/class-final.vapi-expected
new file mode 100644
index 000000000..4279e1fba
--- /dev/null
+++ b/tests/gir/class-final.vapi-expected
@@ -0,0 +1,13 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_bar_get_type ()")]
+ public sealed class Bar : Test.Foo {
+ [CCode (has_construct_function = false)]
+ protected Bar ();
+ }
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Foo ();
+ }
+}
diff --git a/tests/gir/class.test b/tests/gir/class.gir
similarity index 82%
rename from tests/gir/class.test
rename to tests/gir/class.gir
index cf265569d..8ee9fc010 100644
--- a/tests/gir/class.test
+++ b/tests/gir/class.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<alias name="Bar" c:type="TestBar">
<type name="Foo" c:type="TestFoo"/>
</alias>
@@ -130,31 +134,5 @@ Input:
</callback>
</field>
</record>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class Bar : Test.Foo {
- [CCode (has_construct_function = false)]
- protected Bar ();
-}
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class Foo : GLib.Object, Test.IFoo {
- [CCode (has_construct_function = false)]
- public Foo ();
- [CCode (cname = "test_foo_new_bar", has_construct_function = false)]
- public Foo.bar ();
- public string get_prop ();
- public async void method_async (string input, out string output) throws GLib.Error;
- public virtual void method_virtual () throws GLib.Error;
- public void set_prop (string value);
- public string prop { owned get; set construct; }
- public signal void sig (string arg);
-}
-[CCode (cheader_filename = "test.h")]
-public interface IBar : Test.IFoo, GLib.Object {
-}
-[CCode (cheader_filename = "test.h", type_id = "test_ifoo_get_type ()")]
-public interface IFoo : GLib.Object {
- public abstract void method () throws GLib.Error;
-}
+</namespace>
+</repository>
diff --git a/tests/gir/class.vapi-expected b/tests/gir/class.vapi-expected
new file mode 100644
index 000000000..fcf6f18dc
--- /dev/null
+++ b/tests/gir/class.vapi-expected
@@ -0,0 +1,28 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Bar : Test.Foo {
+ [CCode (has_construct_function = false)]
+ protected Bar ();
+ }
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Foo : GLib.Object, Test.IFoo {
+ [CCode (has_construct_function = false)]
+ public Foo ();
+ [CCode (cname = "test_foo_new_bar", has_construct_function = false)]
+ public Foo.bar ();
+ public string get_prop ();
+ public async void method_async (string input, out string output) throws GLib.Error;
+ public virtual void method_virtual () throws GLib.Error;
+ public void set_prop (string value);
+ public string prop { owned get; set construct; }
+ public signal void sig (string arg);
+ }
+ [CCode (cheader_filename = "test.h")]
+ public interface IBar : Test.IFoo, GLib.Object {
+ }
+ [CCode (cheader_filename = "test.h", type_id = "test_ifoo_get_type ()")]
+ public interface IFoo : GLib.Object {
+ public abstract void method () throws GLib.Error;
+ }
+}
diff --git a/tests/gir/constant.gir b/tests/gir/constant.gir
new file mode 100644
index 000000000..5e5755a03
--- /dev/null
+++ b/tests/gir/constant.gir
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<constant name="FOO_CONSTANT"
+ value="foo-constant-string-value"
+ c:type="TEST_FOO_CONSTANT">
+ <type name="utf8" c:type="gchar*"/>
+</constant>
+<constant name="FOO_CONSTANT_ARRAY"
+ c:type="TEST_FOO_CONSTANT_ARRAY">
+ <array c:type="const gchar**">
+ <type name="utf8" c:type="const gchar*"/>
+ </array>
+</constant>
+</namespace>
+</repository>
diff --git a/tests/gir/constant.vapi-expected b/tests/gir/constant.vapi-expected
new file mode 100644
index 000000000..d514868b3
--- /dev/null
+++ b/tests/gir/constant.vapi-expected
@@ -0,0 +1,7 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", cname = "TEST_FOO_CONSTANT")]
+ public const string FOO_CONSTANT;
+ [CCode (array_length = false, array_null_terminated = true, cheader_filename = "test.h", cname =
"TEST_FOO_CONSTANT_ARRAY")]
+ public const string[] FOO_CONSTANT_ARRAY;
+}
diff --git a/tests/gir/delegate-alias-without-target.gir b/tests/gir/delegate-alias-without-target.gir
new file mode 100644
index 000000000..dbed38be7
--- /dev/null
+++ b/tests/gir/delegate-alias-without-target.gir
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<alias name="Foo" c:type="TestFoo">
+ <type name="Bar" c:type="TestBar"/>
+</alias>
+
+<callback name="Bar" c:type="TestBar">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+</callback>
+</namespace>
+</repository>
diff --git a/tests/gir/delegate-alias-without-target.vapi-expected
b/tests/gir/delegate-alias-without-target.vapi-expected
new file mode 100644
index 000000000..cce45da14
--- /dev/null
+++ b/tests/gir/delegate-alias-without-target.vapi-expected
@@ -0,0 +1,7 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", has_target = false)]
+ public delegate void Bar ();
+ [CCode (cheader_filename = "test.h", has_target = false)]
+ public delegate void Foo ();
+}
diff --git a/tests/gir/delegate-anonymous.test b/tests/gir/delegate-anonymous.gir
similarity index 57%
rename from tests/gir/delegate-anonymous.test
rename to tests/gir/delegate-anonymous.gir
index 0c4fd1626..381f9cff4 100644
--- a/tests/gir/delegate-anonymous.test
+++ b/tests/gir/delegate-anonymous.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<record name="Foo" c:type="TestFoo">
<field name="bar_callback">
<callback name="bar_callback" throws="1">
@@ -24,12 +28,5 @@ Input:
</callback>
</field>
</record>
-
-Output:
-
-[CCode (cheader_filename = "test.h", has_type_id = false)]
-public struct Foo {
- public weak Test.FooBarCallbackFunc bar_callback;
-}
-[CCode (cheader_filename = "test.h", has_target = false, has_typedef = false)]
-public delegate void* FooBarCallbackFunc (GLib.SourceFunc func) throws GLib.Error;
+</namespace>
+</repository>
diff --git a/tests/gir/delegate-anonymous.vapi-expected b/tests/gir/delegate-anonymous.vapi-expected
new file mode 100644
index 000000000..45a4f9b90
--- /dev/null
+++ b/tests/gir/delegate-anonymous.vapi-expected
@@ -0,0 +1,9 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", has_type_id = false)]
+ public struct Foo {
+ public weak Test.FooBarCallbackFunc bar_callback;
+ }
+ [CCode (cheader_filename = "test.h", has_target = false, has_typedef = false)]
+ public delegate void* FooBarCallbackFunc (GLib.SourceFunc func) throws GLib.Error;
+}
diff --git a/tests/gir/delegate-array-length-type.test b/tests/gir/delegate-array-length-type.gir
similarity index 52%
rename from tests/gir/delegate-array-length-type.test
rename to tests/gir/delegate-array-length-type.gir
index 127ac8a76..4a31d211e 100644
--- a/tests/gir/delegate-array-length-type.test
+++ b/tests/gir/delegate-array-length-type.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<callback name="Foo" c:type="TestFoo">
<return-value transfer-ownership="full">
<array length="0" c:type="gchar**">
@@ -21,8 +25,5 @@ Input:
</parameter>
</parameters>
</callback>
-
-Output:
-
-[CCode (array_length_pos = 0.1, array_length_type = "gsize", cheader_filename = "test.h", instance_pos =
0.9)]
-public delegate string[] Foo ();
+</namespace>
+</repository>
diff --git a/tests/gir/delegate-array-length-type.vapi-expected
b/tests/gir/delegate-array-length-type.vapi-expected
new file mode 100644
index 000000000..ac05cdd9c
--- /dev/null
+++ b/tests/gir/delegate-array-length-type.vapi-expected
@@ -0,0 +1,5 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (array_length_pos = 0.1, array_length_type = "gsize", cheader_filename = "test.h",
instance_pos = 0.9)]
+ public delegate string[] Foo ();
+}
diff --git a/tests/gir/delegate-closure-destroy-index-conflict.test
b/tests/gir/delegate-closure-destroy-index-conflict.gir
similarity index 79%
rename from tests/gir/delegate-closure-destroy-index-conflict.test
rename to tests/gir/delegate-closure-destroy-index-conflict.gir
index 449136c90..e8c0bb8bb 100644
--- a/tests/gir/delegate-closure-destroy-index-conflict.test
+++ b/tests/gir/delegate-closure-destroy-index-conflict.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="Foo"
c:symbol-prefix="foo"
c:type="TestFoo"
@@ -52,15 +56,5 @@ Input:
</parameter>
</parameters>
</function>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class Foo : GLib.Object {
- [CCode (has_construct_function = false)]
- protected Foo ();
- [CCode (cname = "test_function")]
- public void function (owned GLib.Func? callback);
-}
-[CCode (cheader_filename = "test.h")]
-public static void function (owned GLib.Func? callback);
+</namespace>
+</repository>
diff --git a/tests/gir/delegate-closure-destroy-index-conflict.vapi-expected
b/tests/gir/delegate-closure-destroy-index-conflict.vapi-expected
new file mode 100644
index 000000000..f4f5e4269
--- /dev/null
+++ b/tests/gir/delegate-closure-destroy-index-conflict.vapi-expected
@@ -0,0 +1,12 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Foo ();
+ [CCode (cname = "test_function")]
+ public void function (owned GLib.Func? callback);
+ }
+ [CCode (cheader_filename = "test.h")]
+ public static void function (owned GLib.Func? callback);
+}
diff --git a/tests/gir/delegate-error-pos.test b/tests/gir/delegate-error-pos.gir
similarity index 55%
rename from tests/gir/delegate-error-pos.test
rename to tests/gir/delegate-error-pos.gir
index 37f943d50..85789919c 100644
--- a/tests/gir/delegate-error-pos.test
+++ b/tests/gir/delegate-error-pos.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<callback name="Foo" c:type="TestFoo">
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@@ -22,8 +26,5 @@ Input:
</parameter>
</parameters>
</callback>
-
-Output:
-
-[CCode (cheader_filename = "test.h", error_pos = 1.8, instance_pos = 1.9)]
-public delegate void Foo (string s) throws GLib.Error;
+</namespace>
+</repository>
diff --git a/tests/gir/delegate-error-pos.vapi-expected b/tests/gir/delegate-error-pos.vapi-expected
new file mode 100644
index 000000000..dceda39dc
--- /dev/null
+++ b/tests/gir/delegate-error-pos.vapi-expected
@@ -0,0 +1,5 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", error_pos = 1.8, instance_pos = 1.9)]
+ public delegate void Foo (string s) throws GLib.Error;
+}
diff --git a/tests/gir/enum.test b/tests/gir/enum.gir
similarity index 67%
rename from tests/gir/enum.test
rename to tests/gir/enum.gir
index 251981a8b..1be32cd3c 100644
--- a/tests/gir/enum.test
+++ b/tests/gir/enum.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<enumeration name="Test"
c:type="Test">
<member name="bar"
@@ -54,28 +58,5 @@ Input:
glib:nick="foo">
</member>
</bitfield>
-
-Output:
-
-[CCode (cheader_filename = "test.h", cname = "Test", cprefix = "TEST_", has_type_id = false)]
-public enum Test {
- BAR,
- FOO
-}
-[CCode (cheader_filename = "test.h", cname = "TestFlag", cprefix = "TEST_FLAG_", has_type_id = false)]
-[Flags]
-public enum TestFlag {
- BAR,
- FOO
-}
-[CCode (cheader_filename = "test.h", cname = "TestFlagWithType", cprefix = "TEST_FLAG_WITH_TYPE_", type_id =
"test_flag_with_type_get_type ()")]
-[Flags]
-public enum TestFlagWithType {
- BAR,
- FOO
-}
-[CCode (cheader_filename = "test.h", cname = "TestWithType", cprefix = "TEST_WITH_TYPE_", type_id =
"test_with_type_get_type ()")]
-public enum TestWithType {
- BAR,
- FOO
-}
+</namespace>
+</repository>
diff --git a/tests/gir/enum.vapi-expected b/tests/gir/enum.vapi-expected
new file mode 100644
index 000000000..3a8847368
--- /dev/null
+++ b/tests/gir/enum.vapi-expected
@@ -0,0 +1,25 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", cname = "Test", cprefix = "TEST_", has_type_id = false)]
+ public enum Test {
+ BAR,
+ FOO
+ }
+ [CCode (cheader_filename = "test.h", cname = "TestFlag", cprefix = "TEST_FLAG_", has_type_id = false)]
+ [Flags]
+ public enum TestFlag {
+ BAR,
+ FOO
+ }
+ [CCode (cheader_filename = "test.h", cname = "TestFlagWithType", cprefix = "TEST_FLAG_WITH_TYPE_",
type_id = "test_flag_with_type_get_type ()")]
+ [Flags]
+ public enum TestFlagWithType {
+ BAR,
+ FOO
+ }
+ [CCode (cheader_filename = "test.h", cname = "TestWithType", cprefix = "TEST_WITH_TYPE_", type_id =
"test_with_type_get_type ()")]
+ public enum TestWithType {
+ BAR,
+ FOO
+ }
+}
diff --git a/tests/gir/errordomain.test b/tests/gir/errordomain.gir
similarity index 63%
rename from tests/gir/errordomain.test
rename to tests/gir/errordomain.gir
index bf37f46ef..221cf584d 100644
--- a/tests/gir/errordomain.test
+++ b/tests/gir/errordomain.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<enumeration name="TestError"
c:type="TestError"
glib:error-domain="test-error-quark">
@@ -30,16 +34,5 @@ Input:
glib:nick="foo">
</member>
</enumeration>
-
-Output:
-
-[CCode (cheader_filename = "test.h", cname = "TestError", cprefix = "TEST_ERROR_", has_type_id = false)]
-public errordomain TestError {
- BAR,
- FOO
-}
-[CCode (cheader_filename = "test.h", cname = "TestErrorWithType", cprefix = "TEST_ERROR_WITH_TYPE_", type_id
= "test_error_with_type_get_type ()")]
-public errordomain TestErrorWithType {
- BAR,
- FOO
-}
+</namespace>
+</repository>
diff --git a/tests/gir/errordomain.vapi-expected b/tests/gir/errordomain.vapi-expected
new file mode 100644
index 000000000..1a735dcb0
--- /dev/null
+++ b/tests/gir/errordomain.vapi-expected
@@ -0,0 +1,13 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", cname = "TestError", cprefix = "TEST_ERROR_", has_type_id =
false)]
+ public errordomain TestError {
+ BAR,
+ FOO
+ }
+ [CCode (cheader_filename = "test.h", cname = "TestErrorWithType", cprefix = "TEST_ERROR_WITH_TYPE_",
type_id = "test_error_with_type_get_type ()")]
+ public errordomain TestErrorWithType {
+ BAR,
+ FOO
+ }
+}
diff --git a/tests/gir/gtype-struct-name.test b/tests/gir/gtype-struct-name.gir
similarity index 65%
rename from tests/gir/gtype-struct-name.test
rename to tests/gir/gtype-struct-name.gir
index 3ad28cac5..7f839e6a8 100644
--- a/tests/gir/gtype-struct-name.test
+++ b/tests/gir/gtype-struct-name.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<interface name="Foo"
c:symbol-prefix="foo"
c:type="TestFoo"
@@ -34,14 +38,5 @@ Input:
<type name="GObject.ObjectClass" c:type="GObjectClass"/>
</field>
</record>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_cname = "TestBarKlass", type_id = "test_bar_get_type ()")]
-public class Bar : GLib.Object {
- [CCode (has_construct_function = false)]
- protected Bar ();
-}
-[CCode (cheader_filename = "test.h", type_cname = "TestFooInterface", type_id = "test_foo_get_type ()")]
-public interface Foo : GLib.Object {
-}
+</namespace>
+</repository>
diff --git a/tests/gir/gtype-struct-name.vapi-expected b/tests/gir/gtype-struct-name.vapi-expected
new file mode 100644
index 000000000..96a1ebdf8
--- /dev/null
+++ b/tests/gir/gtype-struct-name.vapi-expected
@@ -0,0 +1,11 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_cname = "TestBarKlass", type_id = "test_bar_get_type ()")]
+ public class Bar : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Bar ();
+ }
+ [CCode (cheader_filename = "test.h", type_cname = "TestFooInterface", type_id = "test_foo_get_type
()")]
+ public interface Foo : GLib.Object {
+ }
+}
diff --git a/tests/gir/instance-parameter-owned.test b/tests/gir/instance-parameter-owned.gir
similarity index 67%
rename from tests/gir/instance-parameter-owned.test
rename to tests/gir/instance-parameter-owned.gir
index 27cf75dcb..9048bcd08 100644
--- a/tests/gir/instance-parameter-owned.test
+++ b/tests/gir/instance-parameter-owned.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<record name="Foo"
c:type="TestFoo"
glib:type-name="TestFoo"
@@ -35,16 +39,5 @@ Input:
</parameters>
</method>
</record>
-
-Output:
-
-[CCode (cheader_filename = "test.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id
= "test_foo_get_type ()")]
-[Compact]
-public class Foo {
- [CCode (has_construct_function = false)]
- public Foo ();
- [DestroysInstance]
- public Test.Foo bar ();
- [DestroysInstance]
- public void baz ();
-}
+</namespace>
+</repository>
diff --git a/tests/gir/instance-parameter-owned.vapi-expected
b/tests/gir/instance-parameter-owned.vapi-expected
new file mode 100644
index 000000000..df9693cf2
--- /dev/null
+++ b/tests/gir/instance-parameter-owned.vapi-expected
@@ -0,0 +1,13 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free",
type_id = "test_foo_get_type ()")]
+ [Compact]
+ public class Foo {
+ [CCode (has_construct_function = false)]
+ public Foo ();
+ [DestroysInstance]
+ public Test.Foo bar ();
+ [DestroysInstance]
+ public void baz ();
+ }
+}
diff --git a/tests/gir/method-array-length-type.gir b/tests/gir/method-array-length-type.gir
new file mode 100644
index 000000000..f8447e10f
--- /dev/null
+++ b/tests/gir/method-array-length-type.gir
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<function name="function" c:identifier="test_function">
+ <return-value transfer-ownership="full">
+ <array length="0" c:type="gchar**">
+ <type name="utf8"/>
+ </array>
+ </return-value>
+ <parameters>
+ <parameter name="result_length" direction="out" transfer-ownership="none">
+ <type name="gsize" c:type="gsize*"/>
+ </parameter>
+ </parameters>
+</function>
+</namespace>
+</repository>
diff --git a/tests/gir/method-array-length-type.vapi-expected
b/tests/gir/method-array-length-type.vapi-expected
new file mode 100644
index 000000000..1f4cbc4d9
--- /dev/null
+++ b/tests/gir/method-array-length-type.vapi-expected
@@ -0,0 +1,5 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (array_length_pos = 0.1, array_length_type = "gsize", cheader_filename = "test.h")]
+ public static string[] function ();
+}
diff --git a/tests/gir/method-class.test b/tests/gir/method-class.gir
similarity index 60%
rename from tests/gir/method-class.test
rename to tests/gir/method-class.gir
index adb7ec105..54451b207 100644
--- a/tests/gir/method-class.test
+++ b/tests/gir/method-class.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="Foo"
c:symbol-prefix="foo"
c:type="TestFoo"
@@ -29,13 +33,5 @@ Input:
</parameters>
</method>
</record>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public abstract class Foo : GLib.Object {
- [CCode (has_construct_function = false)]
- protected Foo ();
- [CCode (cname = "test_foo_class_bar")]
- public class void bar ();
-}
+</namespace>
+</repository>
diff --git a/tests/gir/method-class.vapi-expected b/tests/gir/method-class.vapi-expected
new file mode 100644
index 000000000..cf8e79c1c
--- /dev/null
+++ b/tests/gir/method-class.vapi-expected
@@ -0,0 +1,10 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public abstract class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Foo ();
+ [CCode (cname = "test_foo_class_bar")]
+ public class void bar ();
+ }
+}
diff --git a/tests/gir/method-nowrapper.test b/tests/gir/method-nowrapper.gir
similarity index 66%
rename from tests/gir/method-nowrapper.test
rename to tests/gir/method-nowrapper.gir
index ed2c1deca..707204702 100644
--- a/tests/gir/method-nowrapper.test
+++ b/tests/gir/method-nowrapper.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="Foo"
c:symbol-prefix="foo"
c:type="TestFoo"
@@ -39,13 +43,5 @@ Input:
</callback>
</field>
</record>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public abstract class Foo : GLib.Object {
- [CCode (has_construct_function = false)]
- protected Foo ();
- [NoWrapper]
- public virtual bool bar ();
-}
+</namespace>
+</repository>
diff --git a/tests/gir/method-nowrapper.vapi-expected b/tests/gir/method-nowrapper.vapi-expected
new file mode 100644
index 000000000..a40f6a30c
--- /dev/null
+++ b/tests/gir/method-nowrapper.vapi-expected
@@ -0,0 +1,10 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public abstract class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Foo ();
+ [NoWrapper]
+ public virtual bool bar ();
+ }
+}
diff --git a/tests/gir/parameter-array-length-type.gir b/tests/gir/parameter-array-length-type.gir
new file mode 100644
index 000000000..74b6232c6
--- /dev/null
+++ b/tests/gir/parameter-array-length-type.gir
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<function name="function" c:identifier="test_function">
+ <return-value transfer-ownership="none">
+ <type name="none"/>
+ </return-value>
+ <parameters>
+ <parameter name="foo" transfer-ownership="none">
+ <array length="1" c:type="gchar**">
+ <type name="utf8"/>
+ </array>
+ </parameter>
+ <parameter name="foo_length" transfer-ownership="none">
+ <type name="gsize" c:type="gsize"/>
+ </parameter>
+ </parameters>
+</function>
+</namespace>
+</repository>
diff --git a/tests/gir/parameter-array-length-type.vapi-expected
b/tests/gir/parameter-array-length-type.vapi-expected
new file mode 100644
index 000000000..928802875
--- /dev/null
+++ b/tests/gir/parameter-array-length-type.vapi-expected
@@ -0,0 +1,5 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h")]
+ public static void function ([CCode (array_length_cname = "foo_length", array_length_pos = 1.1,
array_length_type = "gsize")] string[] foo);
+}
diff --git a/tests/gir/parameter-nullable-out-simple-type.gir
b/tests/gir/parameter-nullable-out-simple-type.gir
new file mode 100644
index 000000000..1ff4a28e5
--- /dev/null
+++ b/tests/gir/parameter-nullable-out-simple-type.gir
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<function name="function" c:identifier="test_function">
+ <return-value transfer-ownership="none">
+ <type name="none"/>
+ </return-value>
+ <parameters>
+ <parameter name="i" direction="out" transfer-ownership="full" nullable="1">
+ <type name="gint" c:type="gint*"/>
+ </parameter>
+ </parameters>
+</function>
+</namespace>
+</repository>
diff --git a/tests/gir/parameter-nullable-out-simple-type.vapi-expected
b/tests/gir/parameter-nullable-out-simple-type.vapi-expected
new file mode 100644
index 000000000..6703258c5
--- /dev/null
+++ b/tests/gir/parameter-nullable-out-simple-type.vapi-expected
@@ -0,0 +1,5 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h")]
+ public static void function (out int i);
+}
diff --git a/tests/gir/property-non-readable.gir b/tests/gir/property-non-readable.gir
new file mode 100644
index 000000000..d2de2d156
--- /dev/null
+++ b/tests/gir/property-non-readable.gir
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<class name="Foo" c:type="TestFoo" glib:type-name="TestFoo" glib:get-type="test_foo_get_type"
glib:type-struct="FooClass" parent="GObject.Object">
+ <property name="prop" readable="0" writable="1" construct-only="1">
+ <type name="gint" c:type="gint"/>
+ </property>
+</class>
+<record name="FooClass" c:type="TestFooClass" glib:is-gtype-struct-for="Foo"/>
+</namespace>
+</repository>
diff --git a/tests/gir/property-non-readable.vapi-expected b/tests/gir/property-non-readable.vapi-expected
new file mode 100644
index 000000000..d4af9e7da
--- /dev/null
+++ b/tests/gir/property-non-readable.vapi-expected
@@ -0,0 +1,10 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Foo ();
+ [NoAccessorMethod]
+ public int prop { construct; }
+ }
+}
diff --git a/tests/gir/signal-virtual.test b/tests/gir/signal-virtual.gir
similarity index 71%
rename from tests/gir/signal-virtual.test
rename to tests/gir/signal-virtual.gir
index b0073eddd..0bb332b24 100644
--- a/tests/gir/signal-virtual.test
+++ b/tests/gir/signal-virtual.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="Foo" c:type="TestFoo" glib:type-name="TestFoo" glib:get-type="test_foo_get_type"
glib:type-struct="FooClass" parent="GObject.Object">
<virtual-method name="signal_virtual">
<return-value transfer-ownership="full">
@@ -38,12 +42,5 @@ Input:
</callback>
</field>
</record>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class Foo : GLib.Object {
- [CCode (has_construct_function = false)]
- public Foo ();
- public virtual signal void signal_virtual ();
-}
+</namespace>
+</repository>
diff --git a/tests/gir/signal-virtual.vapi-expected b/tests/gir/signal-virtual.vapi-expected
new file mode 100644
index 000000000..b9e1327f3
--- /dev/null
+++ b/tests/gir/signal-virtual.vapi-expected
@@ -0,0 +1,9 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public Foo ();
+ public virtual signal void signal_virtual ();
+ }
+}
diff --git a/tests/gir/symbol-redefined.gir b/tests/gir/symbol-redefined.gir
new file mode 100644
index 000000000..db46556f3
--- /dev/null
+++ b/tests/gir/symbol-redefined.gir
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<enumeration name="Test"
+ c:type="Test">
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_BAR">
+ </member>
+ <member name="foo"
+ value="1"
+ c:identifier="TEST_FOO">
+ </member>
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_BAR">
+ </member>
+</enumeration>
+</namespace>
+</repository>
diff --git a/tests/gir/symbol-redefined.vapi-expected b/tests/gir/symbol-redefined.vapi-expected
new file mode 100644
index 000000000..389f30889
--- /dev/null
+++ b/tests/gir/symbol-redefined.vapi-expected
@@ -0,0 +1,8 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", cname = "Test", cprefix = "TEST_", has_type_id = false)]
+ public enum Test {
+ BAR,
+ FOO
+ }
+}
diff --git a/tests/gir/symbol-type-csuffix.test b/tests/gir/symbol-type-csuffix.gir
similarity index 50%
rename from tests/gir/symbol-type-csuffix.test
rename to tests/gir/symbol-type-csuffix.gir
index 8039d4a8c..896569e6b 100644
--- a/tests/gir/symbol-type-csuffix.test
+++ b/tests/gir/symbol-type-csuffix.gir
@@ -1,7 +1,11 @@
-GIR
-
-Input:
-
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
<class name="TypeFoo" c:type="TestTypeFoo" glib:type-name="TestTypeFoo" glib:get-type="test_foo_get_type"
glib:type-struct="TypeFooClass" parent="GObject.Object">
<constructor name="new" c:identifier="test_type_foo_new">
<return-value transfer-ownership="full">
@@ -14,13 +18,5 @@ Input:
</return-value>
</method>
</class>
-
-Output:
-
-[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
-public class TypeFoo : GLib.Object {
- [CCode (cname = "test_type_foo_new", has_construct_function = false)]
- public TypeFoo ();
- [CCode (cname = "test_type_foo_bar")]
- public void bar ();
-}
+</namespace>
+</repository>
diff --git a/tests/gir/symbol-type-csuffix.vapi-expected b/tests/gir/symbol-type-csuffix.vapi-expected
new file mode 100644
index 000000000..439ce1595
--- /dev/null
+++ b/tests/gir/symbol-type-csuffix.vapi-expected
@@ -0,0 +1,10 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+ public class TypeFoo : GLib.Object {
+ [CCode (cname = "test_type_foo_new", has_construct_function = false)]
+ public TypeFoo ();
+ [CCode (cname = "test_type_foo_bar")]
+ public void bar ();
+ }
+}
diff --git a/tests/gir/symbol-without-name.gir b/tests/gir/symbol-without-name.gir
new file mode 100644
index 000000000..440e6e0f6
--- /dev/null
+++ b/tests/gir/symbol-without-name.gir
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<function name="" c:identifier="test_foo">
+ <return-value transfer-ownership="none">
+ <type name="void"/>
+ </return-value>
+</function>
+<function name="bar" c:identifier="test_bar">
+ <return-value transfer-ownership="none">
+ <type name="void"/>
+ </return-value>
+</function>
+</namespace>
+</repository>
diff --git a/tests/gir/symbol-without-name.vapi-expected b/tests/gir/symbol-without-name.vapi-expected
new file mode 100644
index 000000000..de12f3576
--- /dev/null
+++ b/tests/gir/symbol-without-name.vapi-expected
@@ -0,0 +1,5 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h")]
+ public static void bar ();
+}
diff --git a/tests/gir/union-transparent.gir b/tests/gir/union-transparent.gir
new file mode 100644
index 000000000..80915ba5a
--- /dev/null
+++ b/tests/gir/union-transparent.gir
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<record name="Foo" c:type="TestFoo">
+ <field name="u" writable="1">
+ <type name="guint" c:type="guint"/>
+ </field>
+ <union>
+ <field name="a" writable="1">
+ <array zero-terminated="0" fixed-size="2">
+ <type name="int" c:type="int*"/>
+ </array>
+ </field>
+ <field name="pad" readable="0" private="1">
+ <array zero-terminated="0" fixed-size="4">
+ <type name="guint" c:type="guint"/>
+ </array>
+ </field>
+ </union>
+</record>
+</namespace>
+</repository>
diff --git a/tests/gir/union-transparent.vapi-expected b/tests/gir/union-transparent.vapi-expected
new file mode 100644
index 000000000..fc979eba1
--- /dev/null
+++ b/tests/gir/union-transparent.vapi-expected
@@ -0,0 +1,9 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h", has_type_id = false)]
+ public struct Foo {
+ public uint u;
+ [CCode (array_length = false)]
+ public weak int a[2];
+ }
+}
diff --git a/tests/gir/union.gir b/tests/gir/union.gir
new file mode 100644
index 000000000..c370ed223
--- /dev/null
+++ b/tests/gir/union.gir
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test"
c:symbol-prefixes="test">
+<union name="Foo" c:type="TestFoo">
+ <field name="bar" writable="1">
+ <type name="guint" c:type="guint"/>
+ </field>
+ <field name="manam" writable="1">
+ <type name="gint" c:type="gint"/>
+ </field>
+</union>
+</namespace>
+</repository>
diff --git a/tests/gir/union.vapi-expected b/tests/gir/union.vapi-expected
new file mode 100644
index 000000000..d4016d732
--- /dev/null
+++ b/tests/gir/union.vapi-expected
@@ -0,0 +1,8 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+ [CCode (cheader_filename = "test.h")]
+ public struct Foo {
+ public uint bar;
+ public int manam;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]