Fixed issue with detoken not handling deferred joins correctly

This commit is contained in:
Sam Surtees 2019-02-14 23:14:34 +10:00
parent cda4f94e28
commit 1d24f9994b
2 changed files with 15 additions and 0 deletions

View File

@ -187,6 +187,9 @@
else else
local res = expand_cache[value] local res = expand_cache[value]
if res == nil then if res == nil then
if type(value) == "string" and path.hasdeferredjoin(value) then
value = path.resolvedeferredjoin(value)
end
res = expandvalue(value, e, f) res = expandvalue(value, e, f)
expand_cache[value] = res expand_cache[value] = res
end end

View File

@ -104,6 +104,18 @@
end end
--
-- If a path field contains a token that expands to a deferred join,
-- it should be resolved before performing detoken.
--
function suite.canExpandWithDeferredJoin()
local cwd = os.getcwd()
x = detoken.expand(path.deferredjoin(os.getcwd(), "%{_ACTION}"), environ, {}, cwd)
test.isequal(os.getcwd() .. "/test", x)
end
-- --
-- If the value being expanded is a table, iterate over all of its values. -- If the value being expanded is a table, iterate over all of its values.
-- --