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



commit b2df73bcb3e631b4c0d0a46b5a966347d5f05d3e
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Mon Apr 26 23:59:25 2010 +0200

    Test Glib::IO::FileInfo

 t/file-info.t |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/t/file-info.t b/t/file-info.t
new file mode 100644
index 0000000..a3aea64
--- /dev/null
+++ b/t/file-info.t
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 8;
+use Glib::IO;
+
+my $file = Glib::IO::File->new_for_path ($0);
+my $info = $file->query_info ('*', [], undef);
+
+my $attrs = $info->list_attributes ('standard');
+ok (grep { $_ eq "standard::type" } @$attrs);
+
+my ($success, $type, $memory, $status) =
+  $info->get_attribute_data ('standard::type');
+ok ($success);
+is ($type, 'uint32');
+is ($memory, undef);
+is ($status, 'unset');
+
+my $mod_time = $info->get_modification_time ();
+ok (exists $mod_time->{tv_sec} && exists $mod_time->{tv_usec});
+$info->set_modification_time ({
+  tv_sec => $mod_time->{tv_sec} - 1,
+  tv_usec => $mod_time->{tv_usec}});
+my $new_mod_time = $info->get_modification_time ();
+is ($new_mod_time->{tv_sec}, $mod_time->{tv_sec} - 1);
+
+my $matcher = Glib::IO::FileAttributeMatcher->new ('standard::*');
+ok ($matcher->matches ('standard::type'));



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