dh-ify packaging with dh-make-perl refresh.
[libwww-opensearch-perl.git] / t / 13-request.t
index 24c9396..26f9c3e 100644 (file)
@@ -27,17 +27,26 @@ use_ok( 'WWW::OpenSearch::Request' );
     my $osd = WWW::OpenSearch::Description->new( $description );
 
     {
-        my $req = WWW::OpenSearch::Request->new( $osd->url->[ 2 ], { searchTerms => 'iPod' } );
+        my $req = WWW::OpenSearch::Request->new( $osd->url->[ 2 ],
+            { searchTerms => 'iPod' } );
         isa_ok( $req, 'WWW::OpenSearch::Request' );
         is( lc $req->method, 'post', 'method' );
         is( $req->uri, 'https://intranet/search?format=html', 'uri' );
-        is( $req->content, 'l=*&c=&s=iPod&o=1', 'content' );
+        is( _sort_result( $req->content ), 'c=&l=*&o=1&s=iPod', 'content' );
     }
 
     {
-        my $req = WWW::OpenSearch::Request->new( $osd->url->[ 1 ], { searchTerms => 'iPod' } );
+        my $req = WWW::OpenSearch::Request->new( $osd->url->[ 1 ],
+            { searchTerms => 'iPod' } );
         isa_ok( $req, 'WWW::OpenSearch::Request' );
         is( lc $req->method, 'get', 'method' );
         is( $req->uri, 'http://example.com/?q=iPod&pw=1&format=atom', 'uri' );
     }
 }
+
+sub _sort_result {
+    my $s = shift;
+    return join( '&',
+        sort { substr( $a, 0, 1 ) cmp substr( $b, 0, 1 ) }
+            split( /\&/, $s ) );
+}