[perl-Glib-Object-Introspection] Add object tests
- From: Torsten SchÃnfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Glib-Object-Introspection] Add object tests
- Date: Tue, 9 Aug 2011 15:05:05 +0000 (UTC)
commit 906912326a58b32062be8ab3eed5ebc98c531608
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date: Tue Aug 9 15:26:14 2011 +0200
Add object tests
t/objects.t | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 84 insertions(+), 0 deletions(-)
---
diff --git a/t/objects.t b/t/objects.t
new file mode 100644
index 0000000..3f36c6a
--- /dev/null
+++ b/t/objects.t
@@ -0,0 +1,84 @@
+#!/usr/bin/env perl
+
+BEGIN { require './t/inc/setup.pl' };
+
+use strict;
+use warnings;
+
+plan tests => 36;
+
+my $obj = TestObj->constructor;
+isa_ok ($obj, 'TestObj');
+isa_ok ($obj, 'Glib::Object');
+
+$obj = TestObj->new ($obj);
+isa_ok ($obj, 'TestObj');
+isa_ok ($obj, 'Glib::Object');
+
+$obj = TestObj->new_from_file ($0);
+isa_ok ($obj, 'TestObj');
+isa_ok ($obj, 'Glib::Object');
+
+$obj->set_bare (TestObj->constructor);
+is ($obj->instance_method, -1);
+is (TestObj::static_method (23), 23);
+$obj->forced_method;
+
+my ($y, $z, $q) = $obj->torture_signature_0 (23, 'perl', 42);
+is ($y, 23);
+is ($z, 46);
+is ($q, 46);
+
+is (eval { $obj->torture_signature_1 (23, 'perl', 41); 1 }, undef);
+like ($@, qr/odd/);
+
+SKIP: {
+ skip 'Skipping return values not implemented yet', 3;
+ my ($b, $d, $sum) = $obj->skip_return_val (23, 42, 57, 13, 17);
+ is ($b, 24);
+ is ($d, 58);
+ is ($sum, 13+170);
+}
+
+SKIP: {
+ skip 'Skipping parameters not implemented yet', 10;
+ my ($success, $b, $d, $sum);
+
+ ($success, $b, $d, $sum) = $obj->skip_param (23, 57, 13, 17);
+ ok ($success);
+ is ($b, 24);
+ is ($d, 58);
+ is ($sum, 13+170);
+
+ ($success, $d, $sum) = $obj->skip_out_param (23, 42, 57, 13, 17);
+ ok ($success);
+ is ($d, 58);
+ is ($sum, 13+170);
+
+ ($success, $b, $sum) = $obj->skip_inout_param (23, 42, 13, 17);
+ ok ($success);
+ is ($b, 24);
+ is ($sum, 13+170);
+}
+
+is ($obj->do_matrix ('perl'), 42);
+
+func_obj_null_in ($obj);
+func_obj_null_in (undef);
+is (TestObj::null_out (), undef);
+
+# inheritance
+my $sub = TestSubObj->new;
+isa_ok ($sub, 'TestSubObj');
+isa_ok ($sub, 'TestObj');
+isa_ok ($sub, 'Glib::Object');
+$sub->unset_bare;
+is ($sub->instance_method, 0);
+
+# unusual prefix
+my $wi = TestWi8021x->new;
+isa_ok ($wi, 'TestWi8021x');
+isa_ok ($wi, 'Glib::Object');
+$wi->set_testbool (1);
+ok ($wi->get_testbool);
+is (TestWi8021x::static_method (23), 46);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]