From: Rico Tzschichholz Date: Wed, 25 May 2022 14:48:51 +0000 (+0200) Subject: tests: Split up gir parser tests into dedicated files X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=841ac8c8c963e6fe0e74f82b7880a7049704bf14;p=thirdparty%2Fvala.git tests: Split up gir parser tests into dedicated files --- 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 < $SOURCEFILE - - - - - - - -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 " " >> $SOURCEFILE - echo "" >> $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 147c66676..f549040d8 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 = \ @@ -829,40 +830,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 \ @@ -1448,4 +1449,5 @@ EXTRA_DIST = \ $(TESTS) \ $(LINUX_TESTS) \ $(wildcard $(srcdir)/*/*.c-expected) \ + $(wildcard $(srcdir)/*/*.vapi-expected) \ $(NULL) 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 @@ + + + + + + + + + + + + + diff --git a/tests/gir/alias.test b/tests/gir/alias.test deleted file mode 100644 index 132d32af2..000000000 --- a/tests/gir/alias.test +++ /dev/null @@ -1,14 +0,0 @@ -GIR - -Input: - - - - - -Output: - -[CCode (cheader_filename = "test.h")] -[SimpleType] -public struct Foo : int { -} 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: - + + + + + + + + @@ -55,14 +59,5 @@ Input: - -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]); + + 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: - + + + + + + + + - -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; -} + + 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: - + + + + + + + + @@ -44,13 +48,5 @@ Input: - -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; -} + + 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: - + + + + + + + + @@ -47,12 +51,5 @@ Input: - -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; -} + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/bug651773.test b/tests/gir/bug651773.test deleted file mode 100644 index 7f499de5b..000000000 --- a/tests/gir/bug651773.test +++ /dev/null @@ -1,24 +0,0 @@ -GIR - -Input: - - - - - - - - - - - - - - -Output: - -[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/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: - + + + + + + + + - -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); + + 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: - + + + + + + + + - -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; } -} + + 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: - + + + + + + + + @@ -22,8 +26,5 @@ Input: - -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); + + 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: - + + + + + + + + @@ -41,19 +45,5 @@ Input: - -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; } -} + + 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: - + + + + + + + + @@ -12,16 +16,5 @@ Input: - -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 (); -} + + 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: - + + + + + + + + @@ -130,31 +134,5 @@ Input: - -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; -} + + 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 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/constant.test b/tests/gir/constant.test deleted file mode 100644 index 196ae7577..000000000 --- a/tests/gir/constant.test +++ /dev/null @@ -1,22 +0,0 @@ -GIR - -Input: - - - - - - - - - - -Output: - -[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/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 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/delegate-alias-without-target.test b/tests/gir/delegate-alias-without-target.test deleted file mode 100644 index 1e2fd36a1..000000000 --- a/tests/gir/delegate-alias-without-target.test +++ /dev/null @@ -1,20 +0,0 @@ -GIR - -Input: - - - - - - - - - - - -Output: - -[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-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: - + + + + + + + + @@ -24,12 +28,5 @@ Input: - -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; + + 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: - + + + + + + + + @@ -21,8 +25,5 @@ Input: - -Output: - -[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-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: - + + + + + + + + - -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); + + 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: - + + + + + + + + @@ -22,8 +26,5 @@ Input: - -Output: - -[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/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: - + + + + + + + + - -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 -} + + 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: - + + + + + + + + @@ -30,16 +34,5 @@ Input: glib:nick="foo"> - -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 -} + + 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: - + + + + + + + + - -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 { -} + + 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: - + + + + + + + + - -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 (); -} + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/method-array-length-type.test b/tests/gir/method-array-length-type.test deleted file mode 100644 index b7ebccfc5..000000000 --- a/tests/gir/method-array-length-type.test +++ /dev/null @@ -1,21 +0,0 @@ -GIR - -Input: - - - - - - - - - - - - - - -Output: - -[CCode (array_length_pos = 0.1, array_length_type = "gsize", cheader_filename = "test.h")] -public static string[] function (); 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: - + + + + + + + + - -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 (); -} + + 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: - + + + + + + + + - -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 (); -} + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/parameter-array-length-type.test b/tests/gir/parameter-array-length-type.test deleted file mode 100644 index 3bbbe9ec6..000000000 --- a/tests/gir/parameter-array-length-type.test +++ /dev/null @@ -1,24 +0,0 @@ -GIR - -Input: - - - - - - - - - - - - - - - - - -Output: - -[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-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 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/parameter-nullable-out-simple-type.test b/tests/gir/parameter-nullable-out-simple-type.test deleted file mode 100644 index b444368f2..000000000 --- a/tests/gir/parameter-nullable-out-simple-type.test +++ /dev/null @@ -1,19 +0,0 @@ -GIR - -Input: - - - - - - - - - - - - -Output: - -[CCode (cheader_filename = "test.h")] -public static void function (out int i); 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 @@ + + + + + + + + + + + + + + + + diff --git a/tests/gir/property-non-readable.test b/tests/gir/property-non-readable.test deleted file mode 100644 index 0816a4d75..000000000 --- a/tests/gir/property-non-readable.test +++ /dev/null @@ -1,20 +0,0 @@ -GIR - -Input: - - - - - - - - -Output: - -[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/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: - + + + + + + + + @@ -38,12 +42,5 @@ Input: - -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 (); -} + + 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 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/symbol-redefined.test b/tests/gir/symbol-redefined.test deleted file mode 100644 index 1ae3b3b5a..000000000 --- a/tests/gir/symbol-redefined.test +++ /dev/null @@ -1,27 +0,0 @@ -GIR - -Input: - - - - - - - - - - -Output: - -[CCode (cheader_filename = "test.h", cname = "Test", cprefix = "TEST_", has_type_id = false)] -public enum Test { - BAR, - FOO -} 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: - + + + + + + + + @@ -14,13 +18,5 @@ Input: - -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 (); -} + + 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 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/symbol-without-name.test b/tests/gir/symbol-without-name.test deleted file mode 100644 index 4b56f6bdf..000000000 --- a/tests/gir/symbol-without-name.test +++ /dev/null @@ -1,19 +0,0 @@ -GIR - -Input: - - - - - - - - - - - - -Output: - -[CCode (cheader_filename = "test.h")] -public static void bar (); 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/union-transparent.test b/tests/gir/union-transparent.test deleted file mode 100644 index d2e8e160a..000000000 --- a/tests/gir/union-transparent.test +++ /dev/null @@ -1,30 +0,0 @@ -GIR - -Input: - - - - - - - - - - - - - - - - - - - -Output: - -[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-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 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/gir/union.test b/tests/gir/union.test deleted file mode 100644 index 51f118aa5..000000000 --- a/tests/gir/union.test +++ /dev/null @@ -1,20 +0,0 @@ -GIR - -Input: - - - - - - - - - - -Output: - -[CCode (cheader_filename = "test.h")] -public struct Foo { - public uint bar; - public int manam; -} 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; + } +}