[libflickr-api-perl] 34/40: better Test::More use and some test code cleanup

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Sat Jul 25 21:12:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to tag 1.08
in repository libflickr-api-perl.

commit 55d0b177c391691b2d8406de70b0befdfa151556
Author: Gabor Szabo <gabor at szabgab.com>
Date:   Tue Jun 18 21:52:05 2013 +0300

    better Test::More use and some test code cleanup
---
 t/01-test.t | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/t/01-test.t b/t/01-test.t
index 201109c..a9d27ef 100644
--- a/t/01-test.t
+++ b/t/01-test.t
@@ -68,16 +68,11 @@ is('b8bac3b2a4f919d04821e43adf59288c', $api->sign_args({'foo' => "\x{5315}\x{4e0
 
 my $uri = $api->request_auth_url('r', 'my_frob');
 
-my %expect = &parse_query('api_sig=d749e3a7bd27da9c8af62a15f4c7b48f&perms=r&frob=my_frob&api_key=made_up_key');
-my %got = &parse_query($uri->query);
+my %expect = parse_query('api_sig=d749e3a7bd27da9c8af62a15f4c7b48f&perms=r&frob=my_frob&api_key=made_up_key');
+my %got = parse_query($uri->query);
 
 sub parse_query {
-	my %hash;
-	foreach my $pair (split(/\&/, shift)) {
-		my ($name, $value) = split(/\=/, $pair);
-		$hash{$name} = $value;
-	}
-	return(%hash);
+	return split /[&=]/, shift;
 }
 foreach my $item (keys %expect) {
 	is($expect{$item}, $got{$item}, "Checking that the $item item in the query matches");
@@ -86,9 +81,9 @@ foreach my $item (keys %got) {
 	is($expect{$item}, $got{$item}, "Checking that the $item item in the query matches in reverse");
 }
 
-ok($uri->path eq '/services/auth/', "Checking correct return path");
-ok($uri->host eq 'api.flickr.com', "Checking return domain");
-ok($uri->scheme eq 'http', "Checking return protocol");
+is($uri->path, '/services/auth/', "Checking correct return path");
+is($uri->host, 'api.flickr.com', "Checking return domain");
+is($uri->scheme, 'http', "Checking return protocol");
 
 
 ##################################################
@@ -96,8 +91,8 @@ ok($uri->scheme eq 'http', "Checking return protocol");
 # check we can't generate a url without a secret
 #
 
-$api = new Flickr::API({'key' => 'key'});
+$api = Flickr::API->new({'key' => 'key'});
 $uri = $api->request_auth_url('r', 'frob');
 
-ok(!defined $uri, "Checking URL generation without a secret");
+is($uri, undef, "Checking URL generation without a secret");
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libflickr-api-perl.git



More information about the Pkg-perl-cvs-commits mailing list