lean2/tests/lua/n7.lua
Leonardo de Moura 3145cee51f refactor(library/aliases): move replace_prefix to util/name
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 15:11:22 -07:00

7 lines
474 B
Lua

local n1 = name("foo", "bar", 1)
assert(n1:replace_prefix("foo", {"hello", "world"}) == name("hello", "world", "bar", 1))
assert(n1:replace_prefix("foo2", {"hello", "world"}) == name("foo", "bar", 1))
assert(n1:replace_prefix("foo", nil) == name("bar", 1))
assert(n1:replace_prefix("foo", name()) == name("bar", 1))
assert(n1:replace_prefix({"foo", "bar"}, {"hello", "world"}) == name("hello", "world", 1))
assert(n1:replace_prefix({"foo", "bar"}, "tst") == name("tst", 1))