mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Bug #58257 mysqltest: in if(), ! $var with space is always false
Evaluation would start with the space and thus ignore the $ Added while() to skip past white space
This commit is contained in:
parent
92a1a11203
commit
32ea070845
3 changed files with 14 additions and 1 deletions
|
@ -5434,7 +5434,9 @@ void do_block(enum block_cmd cmd, struct st_command* command)
|
|||
if (*expr_start == '!')
|
||||
{
|
||||
not_expr= TRUE;
|
||||
expr_start++; /* Step past the '!' */
|
||||
expr_start++; /* Step past the '!', then any whitespace */
|
||||
while (*expr_start && my_isspace(charset_info, *expr_start))
|
||||
expr_start++;
|
||||
}
|
||||
/* Find ending ')' */
|
||||
expr_end= strrchr(expr_start, ')');
|
||||
|
|
|
@ -402,7 +402,9 @@ true-inner
|
|||
true-inner again
|
||||
true-outer
|
||||
Counter is greater than 0, (counter=10)
|
||||
Counter should still be 10, is 10
|
||||
Counter is not 0, (counter=0)
|
||||
Not space var works
|
||||
Counter is true, (counter=alpha)
|
||||
Beta is true
|
||||
while with string, only once
|
||||
|
|
|
@ -1138,6 +1138,11 @@ if (!$counter)
|
|||
{
|
||||
echo Counter is not 0, (counter=10);
|
||||
}
|
||||
if (! $counter)
|
||||
{
|
||||
let $counter=5;
|
||||
}
|
||||
echo Counter should still be 10, is $counter;
|
||||
let $counter=0;
|
||||
if($counter)
|
||||
{
|
||||
|
@ -1147,6 +1152,10 @@ if (!$counter)
|
|||
{
|
||||
echo Counter is not 0, (counter=0);
|
||||
}
|
||||
if (! $counter)
|
||||
{
|
||||
echo Not space var works;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test if with some non-numerics
|
||||
|
|
Loading…
Reference in a new issue