tests for do

This commit is contained in:
leaf corcoran 2012-10-31 20:15:44 -07:00
parent c783eff2a4
commit 0d1f25c2de
2 changed files with 75 additions and 0 deletions

27
tests/inputs/do.moon Normal file
View File

@ -0,0 +1,27 @@
do
print "hello"
print "world"
x = do
print "hello"
print "world"
y = do
things = "shhh"
-> "hello: " .. things
-> if something then do "yeah"
t = {
y: do
number = 100
(x) -> x + number
}
(y=(do
x = 10 + 2
x), k=do
"nothing") -> do
"uhhh"

48
tests/outputs/do.lua Normal file
View File

@ -0,0 +1,48 @@
do
print("hello")
print("world")
end
local x
do
print("hello")
x = print("world")
end
local y
do
local things = "shhh"
y = function()
return "hello: " .. things
end
end
local _
_ = function()
if something then
do
return "yeah"
end
end
end
local t = {
y = (function()
local number = 100
return function(x)
return x + number
end
end)()
}
return function(y, k)
if y == nil then
y = ((function()
x = 10 + 2
return x
end)())
end
if k == nil then
do
k = "nothing"
end
end
do
return "uhhh"
end
end