Fixed Scoping issue

This commit is contained in:
2018-11-24 12:42:54 +01:00
parent 638394d25b
commit 62a18e22d4
9 changed files with 76 additions and 104 deletions

View File

@@ -45,5 +45,23 @@ b = a
Assert.Equal(100, a);
}
[Fact]
public void InnerScopeDefinesToUpperLocalIfLogical()
{
const string input = @"
arr = {100, 56, 28}
local value = 0
for key, val in arr do
value = value + val
end
return value
";
var script = new Script(input, BoundScope, StaticScope);
Assert.Empty(script.Diagnostics.Messages);
var result = script.Evaluate<long>();
Assert.Empty(script.Diagnostics.Messages);
Assert.Equal(184, result);
}
}
}