Re: glib filename_to_uri docs
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: glib filename_to_uri docs
- Date: Fri, 06 Feb 2009 15:22:54 +0100
Kevin Ryde wrote:
So, apart from being more thorough, do your test cases also cover more
binding code than the existing tests?
It exercises $hostname==undef, and the results in a wantarray return.
Is it enough to defang for dos by a regexp with "." instead of demanding
"/" for the path sep?
Ah, $hostname == undef is missing indeed; I'll add that. The list context case
is covered by, sadly:
my @info;
ok(!!(@info = Glib->filename_from_uri($uri)));
ok(!!(@info = Glib::filename_from_uri($uri)));
ok(!!(@info = filename_from_uri($uri)));
If you're interested in the MSWin32 related decay of these tests, look at the
attached series of changes. As you can see, the tests started out being very
similar to what you wrote.
Index: t/filename.t
===================================================================
--- t/filename.t (revision 881)
+++ t/filename.t (revision 882)
@@ -24,7 +24,7 @@ use Cwd qw(cwd);
my $path = cwd() . "/" . $filename;
my $host = "localhost";
-my $expected = "file://$host$path";
+my $expected = $^O eq "MSWin32" ? "file:///$path" : "file://$host$path";
is(Glib->filename_to_uri($path, $host), $expected);
is(Glib::filename_to_uri($path, $host), $expected);
Index: t/filename.t
===================================================================
--- t/filename.t (revision 946)
+++ t/filename.t (revision 947)
@@ -24,19 +24,21 @@ use Cwd qw(cwd);
my $path = cwd() . "/" . $filename;
my $host = "localhost";
-my $expected = $^O eq "MSWin32" ? "file:///$path" : "file://$host$path";
+my $uri = "file://$host/$filename";
+my $expected = qr/\Q$filename\E/;
-is(Glib->filename_to_uri($path, $host), $expected);
-is(Glib::filename_to_uri($path, $host), $expected);
-is(filename_to_uri($path, $host), $expected);
-
-is(Glib->filename_from_uri($expected), $path);
-is(Glib::filename_from_uri($expected), $path);
-is(filename_from_uri($expected), $path);
-
-is_deeply([Glib->filename_from_uri($expected)], [$path, $host]);
-is_deeply([Glib::filename_from_uri($expected)], [$path, $host]);
-is_deeply([filename_from_uri($expected)], [$path, $host]);
+like(Glib->filename_to_uri($path, $host), $expected);
+like(Glib::filename_to_uri($path, $host), $expected);
+like(filename_to_uri($path, $host), $expected);
+
+like(Glib->filename_from_uri($uri), $expected);
+like(Glib::filename_from_uri($uri), $expected);
+like(filename_from_uri($uri), $expected);
+
+my @info;
+is(scalar (@info = Glib->filename_from_uri($uri)), 2);
+is(scalar (@info = Glib::filename_from_uri($uri)), 2);
+is(scalar (@info = filename_from_uri($uri)), 2);
SKIP: {
Index: t/filename.t
===================================================================
--- t/filename.t (revision 972)
+++ t/filename.t (revision 973)
@@ -36,9 +36,9 @@ like(Glib::filename_from_uri($uri), $exp
like(filename_from_uri($uri), $expected);
my @info;
-is(scalar (@info = Glib->filename_from_uri($uri)), 2);
-is(scalar (@info = Glib::filename_from_uri($uri)), 2);
-is(scalar (@info = filename_from_uri($uri)), 2);
+ok(!!(@info = Glib->filename_from_uri($uri)));
+ok(!!(@info = Glib::filename_from_uri($uri)));
+ok(!!(@info = filename_from_uri($uri)));
SKIP: {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]