aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2015-06-30 14:10:34 +0200
committerLucas Hoffmann <l-m-h@web.de>2015-06-30 18:06:06 +0200
commitf0850775bfa39de99200a47e04a6e940650954ad (patch)
tree4d7eb100aeb51c11b993117b3563fdd23195c8f6 /test/functional/helpers.lua
parentbfadf5a28b550bf99101c17244d5ea1b926e40c3 (diff)
downloadrneovim-f0850775bfa39de99200a47e04a6e940650954ad.tar.gz
rneovim-f0850775bfa39de99200a47e04a6e940650954ad.tar.bz2
rneovim-f0850775bfa39de99200a47e04a6e940650954ad.zip
tests: Add helpers.write_file() to write short files.
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 3d02aa7fdd..db2122565b 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -207,6 +207,14 @@ local function execute(...)
end
end
+-- Dedent the given text and write it to the file name.
+local function write_file(name, text)
+ local file = io.open(name, 'w')
+ file:write(dedent(text))
+ file:flush()
+ file:close()
+end
+
local function source(code)
local tmpname = os.tmpname()
local tmpfile = io.open(tmpname, "w")
@@ -315,5 +323,6 @@ return {
curtab = curtab,
curbuf_contents = curbuf_contents,
wait = wait,
- set_session = set_session
+ set_session = set_session,
+ write_file = write_file
}