Implements break statement
This commit is contained in:
@@ -59,5 +59,25 @@ return a";
|
||||
Assert.Equal(15, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NumericForLoopBreakTest()
|
||||
{
|
||||
const string input = @"
|
||||
a = 0
|
||||
for i=0,10 do
|
||||
a = a + i
|
||||
if i == 5 then
|
||||
break
|
||||
end
|
||||
end
|
||||
return a
|
||||
";
|
||||
var script = new Script(input, BoundScope, StaticScope);
|
||||
Assert.Empty(script.Diagnostics.Messages);
|
||||
var result = script.Evaluate<long>();
|
||||
Assert.Empty(script.Diagnostics.Messages);
|
||||
Assert.Equal(15, result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,10 @@ namespace UpsilonTests.GeneralTests
|
||||
{
|
||||
const string input = @"
|
||||
a = 10
|
||||
if true then
|
||||
function testFunc()
|
||||
local a = 100
|
||||
end
|
||||
testFunc()
|
||||
";
|
||||
var script = new Script(input, BoundScope, StaticScope);
|
||||
Assert.Empty(script.Diagnostics.Messages);
|
||||
|
||||
Reference in New Issue
Block a user