mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Add regresion test for continue-in-for
Just to ensure that the third part of the for loop (the updater expression list) is correctly run every iteration when 'continue' is used.
This commit is contained in:
parent
d58217ad96
commit
6e229313b1
3 changed files with 45 additions and 0 deletions
21
unit_tests/regression.suite/for-continue.lsl
Normal file
21
unit_tests/regression.suite/for-continue.lsl
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Check that 'continue' executes the updater expression(s) in for loops
|
||||
|
||||
integer x;
|
||||
|
||||
f() inline
|
||||
{
|
||||
++x;
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
timer()
|
||||
{
|
||||
for (x = 1; x < 5; f())
|
||||
{
|
||||
if (x == 3)
|
||||
continue; // still executes f() but not llOwnerSay()
|
||||
llOwnerSay((string)x);
|
||||
}
|
||||
}
|
||||
}
|
23
unit_tests/regression.suite/for-continue.out
Normal file
23
unit_tests/regression.suite/for-continue.out
Normal file
|
@ -0,0 +1,23 @@
|
|||
integer x;
|
||||
|
||||
default
|
||||
{
|
||||
timer()
|
||||
{
|
||||
x = 1;
|
||||
@___for__00001;
|
||||
if (x < 5)
|
||||
{
|
||||
{
|
||||
if (x == 3)
|
||||
jump J_autoGen00002;
|
||||
llOwnerSay((string)x);
|
||||
@J_autoGen00002;
|
||||
}
|
||||
{
|
||||
++x;
|
||||
}
|
||||
jump ___for__00001;
|
||||
}
|
||||
}
|
||||
}
|
1
unit_tests/regression.suite/for-continue.run
Normal file
1
unit_tests/regression.suite/for-continue.run
Normal file
|
@ -0,0 +1 @@
|
|||
./main.py -O breakcont,inline -
|
Loading…
Add table
Add a link
Reference in a new issue