10 my $u = URI->new("http://www.sol.no?foo=4&bar=5&foo=5");
12 my $h = $u->query_form_hash;
13 print "not " unless $h->{foo}[0] eq "4" && $h->{foo}[1] eq "5" && $h->{bar} eq "5";
16 $u->query_form_hash({ a => 1, b => 2});
17 print "not " unless $u->query eq "a=1&b=2" || $u->query eq "b=2&a=1";
20 $u->query("a=1&b=2&a=3&b=4&a=5");
21 print "not " unless $u->query_param == 2 && join(":", $u->query_param) eq "a:b";
24 print "not " unless $u->query_param("a") eq "1" &&
25 join(":", $u->query_param("a")) eq "1:3:5";
28 print "not " unless $u->query_param(a => 11 .. 14) eq "1";
31 print "not " unless $u->query eq "a=11&b=2&a=12&b=4&a=13&a=14";
34 print "not " unless join(":", $u->query_param(a => 11)) eq "11:12:13:14";
37 print "not " unless $u->query eq "a=11&b=2&b=4";
40 print "not " unless $u->query_param_delete("a") eq "11";
43 print "not " unless $u->query eq "b=2&b=4";
46 $u->query_param_append(a => 1, 3, 5);
47 $u->query_param_append(b => 6);
49 print "not " unless $u->query eq "b=2&b=4&a=1&a=3&a=5&b=6";
52 $u->query_param(a => []); # same as $u->query_param_delete("a");
54 print "not " unless $u->query eq "b=2&b=4&b=6";
58 $u->query_param(a => 1, 2, 3);
59 $u->query_param(b => 1);
61 print "not " unless $u->query eq 'a=3&a=2&a=1&b=1';
64 $u->query_param_delete('a');
65 $u->query_param_delete('b');
67 print "not " if $u->query;
70 print "not " unless $u->as_string eq 'http://www.sol.no';
74 $u->query_param(a => 1, 2, 3);
75 $u->query_param(b => 1);
77 print "not " unless $u->query eq 'a=3&a=2&a=1&b=1';
80 $u->query_param('a' => []);
81 $u->query_param('b' => []);
83 print "not " if $u->query;
86 print "not " unless $u->as_string eq 'http://www.sol.no';