mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Add test case for next after getfenv()
This commit is contained in:
parent
fc4871989a
commit
48bffcf69d
1 changed files with 13 additions and 0 deletions
|
@ -13,6 +13,17 @@ do
|
||||||
a = 0; for i=0, 1, 0.1 do a=a+1 end; assert(a==11)
|
a = 0; for i=0, 1, 0.1 do a=a+1 end; assert(a==11)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- NOTE: getfenv breaks fastcalls for the remainder of the source! hence why this is delayed until the end
|
||||||
|
function testgetfenvnext()
|
||||||
|
getfenv().next = {1, 2, 3}
|
||||||
|
local a = 0
|
||||||
|
for i, v in getfenv().next, {1, 2, 3} do a=a+1 end
|
||||||
|
assert(a==3)
|
||||||
|
a = 0
|
||||||
|
for i, v in next, {1, 2, 3} do a=a+1 end
|
||||||
|
assert(a==3)
|
||||||
|
end
|
||||||
|
|
||||||
-- precision tests for for loops
|
-- precision tests for for loops
|
||||||
do
|
do
|
||||||
local a
|
local a
|
||||||
|
@ -193,4 +204,6 @@ do
|
||||||
assert(x == 15)
|
assert(x == 15)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
testgetfenvnext() -- DONT MOVE THIS LINE
|
||||||
|
|
||||||
return"OK"
|
return"OK"
|
||||||
|
|
Loading…
Add table
Reference in a new issue