1
0
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:
unknown
2006-02-15 22:43:42 +01:00
parent fb6928cb24
commit 8c1c10dc20
3 changed files with 78 additions and 5 deletions

View File

@ -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

View File

@ -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