Re: BUG: t/base/headers-auth.t assumes an ordering of hash keys
Gisle Aas (gisle@aas.no)
03 Oct 1998 20:51:55 +0200
Albert Dvornik <bert@genscan.com> writes:
> I've just installed libwww-perl-5.36 with Perl 5.005_52, and noticed a
> small problem during `make test'.
>
> The base/headers-auth test seems to contain a minor bug. After
> calling www_authenticate with a hash ref containing the authentication
> data, it checks the as_string value to make sure it matches what it
> expects. However, it fails to account for the fact that the keys in a
> hash don't have a well-defined ordering.
Did the test really fail for you? I would expect it to fail the same
way for everybody.
Your analysis is correct. I have applied your patch. Thanks!
Regards,
Gisle
> If you believe (as I do) that the random ordering is fine, then the
> test should be fixed by the patch below or a reasonable facsimile.
>
> --Albert Dvornik
> <bert@genscan.com>
>
> --- t/base/headers-auth.t.orig Fri Oct 2 13:03:03 1998
> +++ t/base/headers-auth.t Fri Oct 2 13:17:25 1998
> @@ -35,6 +35,7 @@
> $_ = $res->as_string;
>
> print "not " unless /WWW-Authenticate: Basic realm="foo3", foo=33/ &&
> - /WWW-Authenticate: Digest nonce=bar, foo=foo/;
> + (/WWW-Authenticate: Digest nonce=bar, foo=foo/ ||
> + /WWW-Authenticate: Digest foo=foo, nonce=bar/);
> print "ok 4\n";