Change coder test to only export functions
@@ -25,17 +25,20 @@ describe("Titan coder", function()
run_coder("", "")
end)
- it("compiles a program with constant globals", function()
+ it("Can export functions that return constants", function()
run_coder([[
- x1: integer = 42
- x2: float = 10.5
- x3: boolean = true
- local x4: integer = 13
+ function f(): integer
+ return 10
+ end
+
+ local function g(): integer
+ return 11
+ end
]], [[
- assert.equals(42, test.x1)
- assert.equals(10.5, test.x2)
- assert.equals(true, test.x3)
- assert.equals(nil, test.x4)
+ assert.is_function(test.f)
+ assert.equal(10, test.f())
+ assert.is_nil(test.g)
]])
end)
+
end)
