fixed a crash when a token contains non-escaped backslashes, and added a unit test
This commit is contained in:
parent
701c5a8c65
commit
f5d7ef1a5b
@ -139,7 +139,8 @@
|
||||
end
|
||||
return value
|
||||
else
|
||||
return expandvalue(value)
|
||||
-- escape backslashes: they will break loadstring
|
||||
return expandvalue(value:gsub("\\", "\\\\"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -119,3 +119,13 @@
|
||||
x = detoken.expand(os.getcwd() .. "/%{cfg.objdir}/file", environ, {paths=true,pathVars=true})
|
||||
test.isequal("$(IntDir)/file", x)
|
||||
end
|
||||
|
||||
--
|
||||
-- Escapes backslashes correctly.
|
||||
--
|
||||
|
||||
function suite.escapesBackslashes()
|
||||
environ.foo = "some/path"
|
||||
x = detoken.expand("%{foo:gsub('/', '\\')}", environ)
|
||||
test.isequal("some\\path", x)
|
||||
end
|
||||
|
Reference in New Issue
Block a user