[perl-Glib/gio-support] [gio] Add initial tests



commit 7af1f346bea03b700b5e00c733b0a7bf478bbd76
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Mon Apr 12 23:40:08 2010 +0200

    [gio] Add initial tests

 MANIFEST            |    2 ++
 t/gio_cancellable.t |   13 +++++++++++++
 t/gio_file.t        |   29 +++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/MANIFEST b/MANIFEST
index ebf8390..f2c6914 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -60,6 +60,8 @@ t/e.t
 t/f.t
 t/filename.t
 t/g.t
+t/gio_cancellable.t
+t/gio_file.t
 t/h.t
 t/lazy_loader.t
 t/make_helper.t
diff --git a/t/gio_cancellable.t b/t/gio_cancellable.t
new file mode 100644
index 0000000..e3fd506
--- /dev/null
+++ b/t/gio_cancellable.t
@@ -0,0 +1,13 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+use Glib::IO;
+
+my $cancellable = Glib::IO::Cancellable->new ();
+$cancellable->connect (sub {
+  my ($data) = @_;
+  is ($data->[0], 23);
+  is ($data->[1], 'bla');
+}, [ 23, 'bla' ]);
+$cancellable->cancel ();
diff --git a/t/gio_file.t b/t/gio_file.t
new file mode 100644
index 0000000..b92bcfe
--- /dev/null
+++ b/t/gio_file.t
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 4;
+use Glib::IO;
+
+my $loop = Glib::MainLoop->new ();
+
+# FIXME: Glib::IO::File->new_for_path?
+my $file = Glib::IO::file_new_for_path ($0);
+
+$file->query_info_async ('*', [], 0, undef, \&info, [ 23, 'bla' ]);
+sub info {
+  my ($file, $res, $data) = @_;
+
+  my $info = $file->query_info_finish ($res);
+  ok (defined $info->get_name ());
+  ok (defined $info->get_size ());
+
+  {
+  local $TODO = 'FIXME: user data does not get through in this case';
+  is ($data->[0], 23);
+  is ($data->[1], 'bla');
+  }
+
+  $loop->quit ();
+}
+
+$loop->run ();



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