Skip to content

Commit

Permalink
tests: adds a test for integer coercion, currently failing
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamhm committed Oct 17, 2017
1 parent 0d9a762 commit 0c1e3ab
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/coder_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,25 @@ describe("Titan code generator ", function()
assert.truthy(ok, err)
end)

pending("handles coercion to integer", function()
local code = [[
function fn(): integer
local f: float = 1.0
local i: integer = f
return 1
end
]]
local ast, err = parser.parse(code)
assert.truthy(ast, err)
local ok, err = checker.check(ast, code, "test.titan")
assert.truthy(ok, err)
assert.same("Exp_ToInt", ast[1].block.stats[2].exp._tag)
local ok, err = generate(ast, "titan_test")
assert.truthy(ok, err)
local ok, err = call("titan_test", "local x = titan_test.fn(); assert(math.type(x) == 'integer')")
assert.truthy(ok, err)
end)

end)


0 comments on commit 0c1e3ab

Please sign in to comment.