From 8a13df3ce155a58dae827cf116a17467a539e2ca Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Sun, 17 Nov 2013 11:17:32 -0800 Subject: [PATCH] test(lua/type_inferer): add missing tests Signed-off-by: Leonardo de Moura --- tests/lua/ty2.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/lua/ty2.lua diff --git a/tests/lua/ty2.lua b/tests/lua/ty2.lua new file mode 100644 index 000000000..4fc5361be --- /dev/null +++ b/tests/lua/ty2.lua @@ -0,0 +1,12 @@ +local env = environment() +local inferer = type_inferer(env) +env:add_var("N", Type()) +local N = Const("N") +env:add_var("a", N) +local ctx = context() +ctx = extend(ctx, "x", N) +assert(inferer(Var(0), ctx) == N) +assert(not pcall(function() inferer(Var(1), ctx) end)) +inferer:clear() +assert(inferer(Var(0), ctx) == N) +assert(is_type_inferer(inferer))