Auto-dereference list refs only if really refs.

This allows single-elements lists to not be guessed as a list reference
in list_has, which helps with bug 291357... but still doesn't explain
why old code that used list_has didn't have the same issue.

I have included a test case which fails and is likely related to the
reason though, so hopefully won't be hard to pin down from here.

CCBUG:291357
wilder
Michael Pyne 14 years ago
parent 82dcb40aeb
commit 2f7db9bb6b
  1. 7
      kdesrc-build
  2. 7
      kdesrc-build-test.pl

@ -332,8 +332,13 @@ my $run_mode = 'build'; # Determines if updating, building, installing, etc.
sub list_has(\@$)
{
my $value = pop;
my @list = @_;
# Expand list references if present, otherwise use all params.
my @list = scalar @_ == 1 ? @{$_[0]} : @_;
if (scalar @_ == 1 && (ref $_[0] eq ref [])) {
@list = @{$_[0]};
}
return scalar grep { "$_" eq "$value" } (@list);
}

@ -211,6 +211,13 @@ $testModule->setupEnvironment();
is($ctx->{env}->{'TESTY_MCTEST'}, 'yes', 'setting global set-env for modules');
is($ctx->{env}->{'MOIN'}, '2', 'setting module set-env for modules');
# Ensure that an empty {env} variable is not used.
my $unlikelyEnvVar = 'KDESRC_BUILD_TEST_PATH';
$ENV{$unlikelyEnvVar} = 'FAILED';
$ctx->prependEnvironmentValue($unlikelyEnvVar, 'TEST_PATH');
ok(defined $ctx->{env}->{$unlikelyEnvVar}, 'prependEnvironmentValue queues value');
is($ctx->{env}->{$unlikelyEnvVar}, 'TEST_PATH:FAILED', 'prependEnvironmentValue queues in right order');
# Ensure svn URL hierarchy is correct
like(svn_module_url($testModule), qr{/home/kde/KDE/KDE/test$}, 'svn_module_url prefer module specific to global');
$testModule->setOption('override-url', 'svn://annono');

Loading…
Cancel
Save