mariadb/mysql-test/main/mysqltest-break.test
Andrew Hutchings 8d9bc61d0b Update mysqltest-break.test
This test does not work in embedded and I cannot see an obvious way of fixing that. The test not running in embedded is not the end of the world here.
2023-09-14 06:58:20 +01:00

87 lines
1 KiB
Text

--source include/not_embedded.inc
#
# MDEV-12130 improve mysqltest language
#
# test "break" statement
#
# Break in a single loop
let $cnt= 4;
while($cnt > 1)
{
dec $cnt;
break;
--echo $cnt
--echo Break did not stop a single loop
}
# Break stops inner loop
let $outer= 4;
while($outer > 1)
{
let $inner= 4;
while($inner > 1)
{
if($outer == 2)
{
--echo OK
}
if($inner == 2)
{
break;
}
dec $inner;
}
dec $outer;
--echo $outer
}
# Break stops outer loop
let $inner= 4;
let $outer= 4;
while($outer > 1)
{
break;
while($inner > 1)
{
dec $inner;
--echo Outer loop`s break did not stop inner loop
}
dec $outer;
--echo $outer
}
# Break stops loop in if
let $cnt= 4;
if($cnt > 1)
{
while($cnt)
{
break;
}
dec $cnt;
}
--echo cnt=$cnt
# Break in inner if
let $cnt= 4;
while($cnt > 1)
{
if($cnt == 2)
{
break;
--echo "if" is working after break
}
dec $cnt;
}
--echo cnt=$cnt
# Stray break
--error 1
--exec echo "break;" | $MYSQL_TEST 2>&1