2013-11-09 01:08:11 +00:00
|
|
|
c = context()
|
|
|
|
assert(c:is_empty())
|
|
|
|
print(c)
|
|
|
|
e = context_entry("x", Const("N"))
|
|
|
|
assert(e:get_name() == name("x"))
|
|
|
|
assert(e:get_domain() == Const("N"))
|
2013-12-08 07:21:07 +00:00
|
|
|
assert(not e:get_body())
|
2013-11-09 01:08:11 +00:00
|
|
|
print(e:get_body())
|
|
|
|
c = context(c, e)
|
|
|
|
print(c)
|
|
|
|
assert(not c:is_empty())
|
|
|
|
c = context(c, "y", Const("M"))
|
|
|
|
assert(#c == 2)
|
|
|
|
assert(c:size() == 2)
|
|
|
|
e, c1 = lookup(c, 0)
|
|
|
|
assert(c1:size() == 1)
|
|
|
|
assert(e:get_name() == name("y"))
|
|
|
|
c = context(c, "z", Const("N"), Const("a"))
|
|
|
|
print(c)
|
|
|
|
check_error(function() lookup(c, 10) end)
|
|
|
|
assert(lookup(c, 0):get_body() == Const("a"))
|
|
|
|
assert(not is_context_entry(c))
|
|
|
|
assert(is_context(c))
|
|
|
|
assert(is_context_entry(e))
|
|
|
|
assert(not is_context_entry(c))
|