[perl-Glib-Object-Introspection] Add callback tests



commit 2178c685cc865ef43824abd22f169f1ad432be10
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sat Jun 4 23:20:37 2011 +0200

    Add callback tests

 t/callbacks.t |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/t/callbacks.t b/t/callbacks.t
new file mode 100644
index 0000000..0a9f8cd
--- /dev/null
+++ b/t/callbacks.t
@@ -0,0 +1,26 @@
+#!/usr/bin/env perl
+
+BEGIN { require './t/inc/setup.pl' };
+
+use strict;
+use warnings;
+
+plan tests => 16;
+
+my $data = 42;
+my $result = 23;
+my $callback  = sub { is shift, $data; return $result; };
+
+is (test_callback_user_data ($callback, $data), $result);
+
+is (test_callback_destroy_notify ($callback, $data), $result);
+is (test_callback_destroy_notify ($callback, $data), $result);
+is (test_callback_thaw_notifications (), 46);
+
+test_callback_async ($callback, $data);
+test_callback_async ($callback, $data);
+is (test_callback_thaw_async (), $result);
+
+my $obj = TestObj->new_callback ($callback, $data);
+isa_ok ($obj, 'TestObj');
+is (test_callback_thaw_notifications (), 23);



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