WebService::Google::Suggest Comments
PerlでGoogleのSuggestを利用できる”WebService::Google::Suggest ”。
WebService::Google::Suggest - Google Suggest as an API - metacpan.org
久々に自宅の環境に導入しようとした所、テストでこけてしまった。
WebService-Google-Suggest-0.03/ WebService-Google-Suggest-0.03/t/ WebService-Google-Suggest-0.03/t/00_compile.t WebService-Google-Suggest-0.03/t/01_suggest.t WebService-Google-Suggest-0.03/MANIFEST WebService-Google-Suggest-0.03/lib/ WebService-Google-Suggest-0.03/lib/WebService/ WebService-Google-Suggest-0.03/lib/WebService/Google/ WebService-Google-Suggest-0.03/lib/WebService/Google/Suggest.pm WebService-Google-Suggest-0.03/META.yml WebService-Google-Suggest-0.03/Changes WebService-Google-Suggest-0.03/README WebService-Google-Suggest-0.03/Makefile.PL CPAN: File::Temp loaded ok (v0.20) CPAN.pm: Going to build M/MI/MIYAGAWA/WebService-Google-Suggest-0.03.tar.gz Checking if your kit is complete... Looks good Writing Makefile for WebService::Google::Suggest cp lib/WebService/Google/Suggest.pm blib/lib/WebService/Google/Suggest.pm MIYAGAWA/WebService-Google-Suggest-0.03.tar.gz /usr/bin/make -- OK Running make test /usr/bin/perl5.10.0.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/l b', 'blib/arch')" t/*.t t/00_compile......ok t/01_suggest......1/5 # Failed test 'google completes to google' # at t/01_suggest.t line 11. # got: 'google maps' # expected: 'google' t/01_suggest......5/5 # Looks like you failed 1 test of 5. t/01_suggest...... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/5 subtests Test Summary Report ------------------- t/01_suggest.t (Wstat: 256 Tests: 5 Failed: 1) Failed test: 3 Non-zero exit status: 1 Files=2, Tests=6, 2 wallclock secs ( 0.03 usr 0.02 sys + 0.80 cusr 0.31 csy = 1.15 CPU) Result: FAIL Failed 1/2 test programs. 1/6 subtests failed. make: *** [test_dynamic] Error 1 MIYAGAWA/WebService-Google-Suggest-0.03.tar.gz /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports MIYAGAWA/WebService-Google-Suggest-0.03.tar.gz Running make install make test had returned bad status, won't install without force Failed during this command: MIYAGAWA/WebService-Google-Suggest-0.03.tar.gz: make_test NO
どうやらUnitTestで"google"と期待していたサジェストに"google maps"とリプライがきたのが原因らしい。
テストコード「01_suggest.t」の
「is($data[0]->{query}, "google", "google completes to google");」を
「is($data[0]->{query}, "google maps", "google completes to google");」になおしてあげると無事ビルドできました。
$ vi 01_suggest.t use strict; use Test::More tests => 5; BEGIN { use_ok 'WebService::Google::Suggest' } my $suggest = WebService::Google::Suggest->new(); isa_ok($suggest->ua, "LWP::UserAgent", "ua() retuens LWP"); my @data = $suggest->complete("google"); is($data[0]->{query}, "google maps", "google completes to google"); ok($data[0]->{results}, "google has more than 0 results"); is_deeply( [ $suggest->complete("udfg67a") ], [ ], "empty list" );