lean2/tests/lua/env2.lua
Leonardo de Moura 2af2a69fc6 feat(lua): expose kernel objects in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 09:40:29 -08:00

16 lines
560 B
Lua

env = environment()
env:add_var("N", Type())
env:add_var("x", Const("N"))
for i, v in ipairs(env:objects()) do
print(v:get_name())
end
assert(not env:find_object("N"):is_null())
assert(env:find_object("Z"):is_null())
assert(env:find_object("N"):is_var_decl())
assert(env:find_object("N"):has_type())
assert(env:find_object("N"):has_name())
assert(env:find_object("N"):get_type() == Type())
assert(env:find_object("N"):get_name() == name("N"))
assert(env:find_object("x"):get_type() == Const("N"))
assert(not env:has_parent())
assert(not env:has_children())