httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: switching t_cmp() argument order
Date Wed, 09 Jun 2004 14:25:40 GMT
Geoffrey Young wrote:
> 
> Stas Bekman wrote:
> 
>>+1
> 
> 
>>+1
> 
> 
> ok, here's a patch.  it warns when t_cmp() is used with a regex and the
> arguments are not in the proper order.

cool, but see below

> the mod_perl test suite seems to run fine with it.

but the tests need to be adjusted to swap the args, no?

> +    # this was added in Apache::Test::VERSION 1.12 - remove deprecated
> +    # logic in 1.15.
> +    if (UNIVERSAL::isa($_[0], 'Regexp')) {
> +        my $warning = "WARNING!!! t_cmp() argument order has changed.\n" .
> +                      "use of a regular expression as the first argument\n" .
> +                      "is deprecated.  support will be removed soon.";
> +        t_debug($warning);
> +        ($_[0], $_[1]) = ($_[1], $_[0]);
> +    }

That won't work with readonly args:

% perl -le 'a("A", "b"); sub a {($_[0], $_[1]) = ($_[1], $_[0]);}'
Modification of a read-only value attempted at -e line 1.

>      t_debug("testing : " . pop) if @_ == 3;
> -    t_debug("expected: " . struct_as_string(0, $_[0]));
> -    t_debug("received: " . struct_as_string(0, $_[1]));
> -    return t_is_equal($_[0], $_[1]);
> +    t_debug("received: " . struct_as_string(0, $_[0]));
> +    t_debug("expected: " . struct_as_string(0, $_[1]));
> +    return t_is_equal($_[1], $_[0]);

why the swap of the t_is_equal args?

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Mime
View raw message