[perl-Glib-IO] Test Glib::IO::FileEnumerator



commit 88a2a7688f0c8125a41054284a099fd22c990e0c
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Mon May 3 22:50:23 2010 +0200

    Test Glib::IO::FileEnumerator

 t/file-enumerator.t |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/t/file-enumerator.t b/t/file-enumerator.t
new file mode 100644
index 0000000..4e1af80
--- /dev/null
+++ b/t/file-enumerator.t
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 3;
+use Glib::IO;
+
+my $dir = Glib::IO::File->new_for_path ('.');
+my $enumerator = $dir->enumerate_children ('standard::*', [], undef);
+
+my $next_file = $enumerator->next_file (undef);
+ok (defined $next_file->get_name ());
+
+{
+  my $loop = Glib::MainLoop->new ();
+  $enumerator->next_files_async (2, 0, undef, \&next_files, [ 'bla', 23 ]);
+  sub next_files {
+    my ($enumerator, $res, $data) = @_;
+
+    my $files = $enumerator->next_files_finish ($res);
+    is (scalar @{$files}, 2);
+
+    {
+    local $TODO = 'FIXME: user data does not get through in this case';
+    is_deeply ($data, [ 'bla', 23 ]);
+    }
+
+    $loop->quit ();
+  }
+
+  $loop->run ();
+}



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