diff --git a/tests/lua/name1.lua b/tests/lua/name1.lua new file mode 100644 index 000000000..c5c0913b5 --- /dev/null +++ b/tests/lua/name1.lua @@ -0,0 +1,30 @@ +n = name("a") +assert(n:is_atomic()) +assert(not n:is_anonymous()) +assert(n:is_string()) +assert(not n:is_numeral()) +assert(not pcall(function() n:get_prefix() end)) +n = name() +assert(n:is_atomic()) +assert(n:is_anonymous()) +assert(not n:is_string()) +assert(not n:is_numeral()) +assert(not pcall(function() n:get_prefix() end)) +n = name("a", "b") +assert(not n:is_atomic()) +assert(not n:is_anonymous()) +assert(n:is_string()) +assert(not n:is_numeral()) +assert(n:get_prefix() == name("a")) +assert(n:get_string() == "b") +assert(not pcall(function() n:get_numeral() end)) +n = name(name("A"), 1) +assert(not n:is_atomic()) +assert(not n:is_anonymous()) +assert(not n:is_string()) +assert(n:is_numeral()) +assert(n:get_prefix() == name("A")) +assert(n:get_numeral() == 1) +assert(not pcall(function() n:get_string() end)) + +