72f9e26dab
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
31 lines
1 KiB
Lua
31 lines
1 KiB
Lua
local env = environment()
|
|
env, n1 = add_private_name(env, "foo")
|
|
print(n1)
|
|
env, n2 = add_private_name(env, "foo")
|
|
print(n2)
|
|
env, n3 = add_private_name(env, {"foo", "bla"})
|
|
print(n3)
|
|
assert(n1 ~= n2)
|
|
assert(n1 ~= n3)
|
|
assert(n2 ~= n3)
|
|
assert(hidden_to_user_name(env, n1))
|
|
assert(hidden_to_user_name(env, n1) == name("foo"))
|
|
assert(hidden_to_user_name(env, n2) == name("foo"))
|
|
assert(hidden_to_user_name(env, n3) == name("foo", "bla"))
|
|
print(user_to_hidden_name(env, "foo"))
|
|
assert(user_to_hidden_name(env, "foo") == n2)
|
|
assert(user_to_hidden_name(env, {"foo", "bla"}) == n3)
|
|
|
|
|
|
env:export("prv_mod.olean")
|
|
local env2 = import_modules("prv_mod")
|
|
assert(hidden_to_user_name(env2, n1) == name("foo"))
|
|
assert(hidden_to_user_name(env2, n2) == name("foo"))
|
|
assert(hidden_to_user_name(env2, n3) == name("foo", "bla"))
|
|
assert(not user_to_hidden_name(env2, "foo"))
|
|
assert(not user_to_hidden_name(env2, {"foo", "bla"}))
|
|
env2, n4 = add_private_name(env2, "foo")
|
|
print(n4)
|
|
assert(n1 ~= n4)
|
|
assert(not hidden_to_user_name(env, n4))
|
|
assert(user_to_hidden_name(env2, "foo") == n4)
|