[perl-Glib-Object-Introspection] Add some missing version guards to the tests



commit c85df83f5f01575510d2d050b3cc6f46c13bfa92
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Aug 2 17:16:51 2015 +0200

    Add some missing version guards to the tests

 t/arrays.t   |  144 ++++++++++++++++++++++++++++++++++------------------------
 t/variants.t |    6 ++-
 2 files changed, 89 insertions(+), 61 deletions(-)
---
diff --git a/t/arrays.t b/t/arrays.t
index ff2857a..2358fbb 100644
--- a/t/arrays.t
+++ b/t/arrays.t
@@ -60,7 +60,11 @@ my $string_array_ref = [qw/0 1 2/];
 my $byte_array_ref = [0, ord '1', 0xFF, ord '3'];
 
 # Init-like.
-is_deeply ([GI::init_function ([qw/a b c/])], [Glib::TRUE, [qw/a b/]]);
+SKIP: {
+  skip 'init-like', 1
+    unless check_gi_version (1, 32, 0);
+  is_deeply ([GI::init_function ([qw/a b c/])], [Glib::TRUE, [qw/a b/]]);
+}
 
 # Fixed size.
 is_deeply (GI::array_fixed_int_return (), $int_array_ref);
@@ -72,70 +76,90 @@ is_deeply (GI::array_fixed_out_struct (), [{long_ => 7, int8 => 6}, {long_ => 6,
 is_deeply (GI::array_fixed_inout ($int_array_ref), [reverse @$int_array_ref]);
 
 # Variable size.
-is_deeply (GI::array_return (), $int_array_ref);
-is_deeply ([GI::array_return_etc (23, 42)], [[23, 0, 1, 42], 23+42]);
-GI::array_in ($int_array_ref);
-GI::array_in_len_before ($int_array_ref);
-GI::array_in_len_zero_terminated ($int_array_ref);
-GI::array_string_in ([qw/foo bar/]);
-GI::array_uint8_in ([map { ord } qw/a b c d/]);
-GI::array_struct_in ($boxed_array_ref);
-GI::array_struct_value_in ($boxed_array_ref);
-GI::array_struct_take_in ($boxed_array_ref);
-is ($boxed_array_ref->[2]->long_, 3);
-GI::array_simple_struct_in ([map { { long_ => $_ } } (1, 2, 3)]);
-GI::multi_array_key_value_in ([qw/one two three/],
-                              [map { Glib::Object::Introspection::GValueWrapper->new ('Glib::Int', $_) } (1, 
2, 3)]);
-GI::array_enum_in ([qw/value1 value2 value3/]);
-GI::array_in_guint64_len ($int_array_ref);
-GI::array_in_guint8_len ($int_array_ref);
-is_deeply (GI::array_out (), $int_array_ref);
-is_deeply ([GI::array_out_etc (23, 42)], [[23, 0, 1, 42], 23+42]);
-is_deeply (GI::array_inout ($int_array_ref), [-2..2]);
-is_deeply ([GI::array_inout_etc (23, $int_array_ref, 42)], [[23, -1, 0, 1, 42], 23+42]);
-GI::array_in_nonzero_nonlen (23, [map { ord } qw/a b c d/]);
+SKIP: {
+  skip 'variable size', 7
+    unless check_gi_version (1, 36, 0);
+  is_deeply (GI::array_return (), $int_array_ref);
+  is_deeply ([GI::array_return_etc (23, 42)], [[23, 0, 1, 42], 23+42]);
+  GI::array_in ($int_array_ref);
+  GI::array_in_len_before ($int_array_ref);
+  GI::array_in_len_zero_terminated ($int_array_ref);
+  GI::array_string_in ([qw/foo bar/]);
+  GI::array_uint8_in ([map { ord } qw/a b c d/]);
+  GI::array_struct_in ($boxed_array_ref);
+  GI::array_struct_value_in ($boxed_array_ref);
+  GI::array_struct_take_in ($boxed_array_ref);
+  is ($boxed_array_ref->[2]->long_, 3);
+  GI::array_simple_struct_in ([map { { long_ => $_ } } (1, 2, 3)]);
+  GI::multi_array_key_value_in ([qw/one two three/],
+                                [map { Glib::Object::Introspection::GValueWrapper->new ('Glib::Int', $_) } 
(1, 2, 3)]);
+  GI::array_enum_in ([qw/value1 value2 value3/]);
+  GI::array_in_guint64_len ($int_array_ref);
+  GI::array_in_guint8_len ($int_array_ref);
+  is_deeply (GI::array_out (), $int_array_ref);
+  is_deeply ([GI::array_out_etc (23, 42)], [[23, 0, 1, 42], 23+42]);
+  is_deeply (GI::array_inout ($int_array_ref), [-2..2]);
+  is_deeply ([GI::array_inout_etc (23, $int_array_ref, 42)], [[23, -1, 0, 1, 42], 23+42]);
+  GI::array_in_nonzero_nonlen (23, [map { ord } qw/a b c d/]);
+}
 
 # Zero-terminated.
-is_deeply (GI::array_zero_terminated_return (), $string_array_ref);
-is (GI::array_zero_terminated_return_null (), undef);
-is_deeply ([map { $_->long_ } @{GI::array_zero_terminated_return_struct ()}],
-           [42, 43, 44]);
-GI::array_zero_terminated_in ($string_array_ref);
-is_deeply (GI::array_zero_terminated_out (), $string_array_ref);
-is_deeply (GI::array_zero_terminated_inout ($string_array_ref), [qw/-1 0 1 2/]);
-# The variant stuff is tested in variants.t.
+SKIP: {
+  skip 'zero-terminated', 5
+    unless check_gi_version (1, 32, 0);
+  is_deeply (GI::array_zero_terminated_return (), $string_array_ref);
+  is (GI::array_zero_terminated_return_null (), undef);
+  is_deeply ([map { $_->long_ } @{GI::array_zero_terminated_return_struct ()}],
+             [42, 43, 44]);
+  GI::array_zero_terminated_in ($string_array_ref);
+  is_deeply (GI::array_zero_terminated_out (), $string_array_ref);
+  is_deeply (GI::array_zero_terminated_inout ($string_array_ref), [qw/-1 0 1 2/]);
+  # The variant stuff is tested in variants.t.
+}
 
 # GArray.
-is_deeply (GI::garray_int_none_return (), $int_array_ref);
-is_deeply (GI::garray_uint64_none_return (), [0, "18446744073709551615"]);
-is_deeply (GI::garray_utf8_none_return (), $string_array_ref);
-is_deeply (GI::garray_utf8_container_return (), $string_array_ref);
-is_deeply (GI::garray_utf8_full_return (), $string_array_ref);
-GI::garray_int_none_in ($int_array_ref);
-GI::garray_uint64_none_in ([0, "18446744073709551615"]);
-GI::garray_utf8_none_in ($string_array_ref);
-is_deeply (GI::garray_utf8_none_out (), $string_array_ref);
-is_deeply (GI::garray_utf8_container_out (), $string_array_ref);
-is_deeply (GI::garray_utf8_full_out (), $string_array_ref);
-# FIXME: is_deeply (GI::garray_utf8_full_out_caller_allocated (), $string_array_ref);
-is_deeply (GI::garray_utf8_none_inout ($string_array_ref), [-2..1]);
-is_deeply (GI::garray_utf8_container_inout ($string_array_ref), [-2..1]);
-# FIXME: This leaks.  See <https://bugzilla.gnome.org/show_bug.cgi?id=745336>.
-is_deeply (GI::garray_utf8_full_inout ($string_array_ref), [-2..1]);
+SKIP: {
+  skip 'GArray', 11
+    unless check_gi_version (1, 34, 0);
+  is_deeply (GI::garray_int_none_return (), $int_array_ref);
+  is_deeply (GI::garray_uint64_none_return (), [0, "18446744073709551615"]);
+  is_deeply (GI::garray_utf8_none_return (), $string_array_ref);
+  is_deeply (GI::garray_utf8_container_return (), $string_array_ref);
+  is_deeply (GI::garray_utf8_full_return (), $string_array_ref);
+  GI::garray_int_none_in ($int_array_ref);
+  GI::garray_uint64_none_in ([0, "18446744073709551615"]);
+  GI::garray_utf8_none_in ($string_array_ref);
+  is_deeply (GI::garray_utf8_none_out (), $string_array_ref);
+  is_deeply (GI::garray_utf8_container_out (), $string_array_ref);
+  is_deeply (GI::garray_utf8_full_out (), $string_array_ref);
+  # FIXME: is_deeply (GI::garray_utf8_full_out_caller_allocated (), $string_array_ref);
+  is_deeply (GI::garray_utf8_none_inout ($string_array_ref), [-2..1]);
+  is_deeply (GI::garray_utf8_container_inout ($string_array_ref), [-2..1]);
+  # FIXME: This leaks.  See <https://bugzilla.gnome.org/show_bug.cgi?id=745336>.
+  is_deeply (GI::garray_utf8_full_inout ($string_array_ref), [-2..1]);
+}
 
 # GPtrArray.
-is_deeply (GI::gptrarray_utf8_none_return (), $string_array_ref);
-is_deeply (GI::gptrarray_utf8_container_return (), $string_array_ref);
-is_deeply (GI::gptrarray_utf8_full_return (), $string_array_ref);
-GI::gptrarray_utf8_none_in ($string_array_ref);
-is_deeply (GI::gptrarray_utf8_none_out (), $string_array_ref);
-is_deeply (GI::gptrarray_utf8_container_out (), $string_array_ref);
-is_deeply (GI::gptrarray_utf8_full_out (), $string_array_ref);
-is_deeply (GI::gptrarray_utf8_none_inout ($string_array_ref), [-2..1]);
-is_deeply (GI::gptrarray_utf8_container_inout ($string_array_ref), [-2..1]);
-# FIXME: This leaks.  See <https://bugzilla.gnome.org/show_bug.cgi?id=745336>.
-is_deeply (GI::gptrarray_utf8_full_inout ($string_array_ref), [-2..1]);
+SKIP: {
+  skip 'GPtrArray', 9
+    unless check_gi_version (0, 12, 0);
+  is_deeply (GI::gptrarray_utf8_none_return (), $string_array_ref);
+  is_deeply (GI::gptrarray_utf8_container_return (), $string_array_ref);
+  is_deeply (GI::gptrarray_utf8_full_return (), $string_array_ref);
+  GI::gptrarray_utf8_none_in ($string_array_ref);
+  is_deeply (GI::gptrarray_utf8_none_out (), $string_array_ref);
+  is_deeply (GI::gptrarray_utf8_container_out (), $string_array_ref);
+  is_deeply (GI::gptrarray_utf8_full_out (), $string_array_ref);
+  is_deeply (GI::gptrarray_utf8_none_inout ($string_array_ref), [-2..1]);
+  is_deeply (GI::gptrarray_utf8_container_inout ($string_array_ref), [-2..1]);
+  # FIXME: This leaks.  See <https://bugzilla.gnome.org/show_bug.cgi?id=745336>.
+  is_deeply (GI::gptrarray_utf8_full_inout ($string_array_ref), [-2..1]);
+}
 
 # GByteArray.
-is_deeply (GI::bytearray_full_return (), $byte_array_ref);
-GI::bytearray_none_in ($byte_array_ref);
+SKIP: {
+  skip 'GByteArray', 1
+    unless check_gi_version (0, 12, 0);
+  is_deeply (GI::bytearray_full_return (), $byte_array_ref);
+  GI::bytearray_none_in ($byte_array_ref);
+}
diff --git a/t/variants.t b/t/variants.t
index 234919c..f819890 100644
--- a/t/variants.t
+++ b/t/variants.t
@@ -6,7 +6,11 @@ use strict;
 use warnings;
 use utf8;
 
-plan tests => 6;
+if (check_gi_version (1, 32, 0)) {
+  plan tests => 6;
+} else {
+  plan skip_all => 'Need gobject-introspection 1.32.0';
+}
 
 my $v1 = Glib::Variant->new ("i", 27);
 my $v2 = Glib::Variant->new ("s", "Hello");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]