mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Add possibility to have a negative expression in "if" and "while" in mysqltest
client/mysqltest.c: Extend 'do_block' to be able to process a !<expression>. Making it possible to do 'if(!$i)' and 'while(!$i)' mysql-test/r/mysqltest.result: Update test results mysql-test/t/mysqltest.test: Add test for if Add test for while with ! expr
This commit is contained in:
@ -309,7 +309,10 @@ test
|
||||
test2
|
||||
test3
|
||||
test4
|
||||
Counter is greater than 0, (counter=10)
|
||||
Counter is not 0, (counter=0)
|
||||
1
|
||||
Testing while with not
|
||||
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply
|
||||
mysqltest: At line 1: missing '(' in while
|
||||
mysqltest: At line 1: missing ')' in while
|
||||
|
@ -742,6 +742,30 @@ echo test3stop
|
||||
--delimiter ;
|
||||
echo test4;
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test if
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
let $counter=10;
|
||||
if ($counter)
|
||||
{
|
||||
echo Counter is greater than 0, (counter=10);
|
||||
}
|
||||
if (!$counter)
|
||||
{
|
||||
echo Counter is not 0, (counter=10);
|
||||
}
|
||||
let $counter=0;
|
||||
if ($counter)
|
||||
{
|
||||
echo Counter is greater than 0, (counter=0);
|
||||
}
|
||||
if (!$counter)
|
||||
{
|
||||
echo Counter is not 0, (counter=0);
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test while, { and }
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -755,7 +779,12 @@ while ($i)
|
||||
# One liner
|
||||
#let $i=1;while ($i){echo $i;dec $i;}
|
||||
|
||||
|
||||
let $i=0;
|
||||
while (!$i)
|
||||
{
|
||||
echo Testing while with not;
|
||||
inc $i;
|
||||
}
|
||||
|
||||
# Exceed max nesting level
|
||||
--error 1
|
||||
|
Reference in New Issue
Block a user