aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-07-04 15:41:59 +0300
committerZyX <kp-pav@yandex.ru>2017-07-04 15:41:59 +0300
commit91b9ad7d8294532939db51db1045605abfff49c2 (patch)
tree1479be19fed3a5db4f635dca7e7ba5d25ac9ccab /test/functional/helpers.lua
parent008b604bacbbeeaf0e04f94b1d331b11ebec631a (diff)
downloadrneovim-91b9ad7d8294532939db51db1045605abfff49c2.tar.gz
rneovim-91b9ad7d8294532939db51db1045605abfff49c2.tar.bz2
rneovim-91b9ad7d8294532939db51db1045605abfff49c2.zip
shada: Make sure that code does not attempt to read too long items
Fixes #6957
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 4a170d993b..6baf77bd3a 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -319,7 +319,14 @@ end
-- Dedent the given text and write it to the file name.
local function write_file(name, text, dont_dedent)
local file = io.open(name, 'w')
- if not dont_dedent then
+ if type(text) == 'table' then
+ -- Byte blob
+ local bytes = text
+ text = ''
+ for _, char in ipairs(bytes) do
+ text = ('%s%c'):format(text, char)
+ end
+ elseif not dont_dedent then
text = dedent(text)
end
file:write(text)