aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-01 03:12:37 +0100
committerGitHub <noreply@github.com>2018-02-01 03:12:37 +0100
commitf8010ea3eca77961312afeb96234678447ce17e4 (patch)
treed9603329fd3320df04f11576d6152491042e9af0 /test/functional/plugin
parent648fed975eb8ddde9c5cbc0f859d06deebf80dd9 (diff)
downloadrneovim-f8010ea3eca77961312afeb96234678447ce17e4.tar.gz
rneovim-f8010ea3eca77961312afeb96234678447ce17e4.tar.bz2
rneovim-f8010ea3eca77961312afeb96234678447ce17e4.zip
test: robust cleanup, unique filenames #7950 (#7950)
Use unique filenames to avoid test conflicts. Use read_file() instead of io.popen(), to ensures the file is closed. Use helpers.rmdir(), it is far more robust than lfs. closes #7911
Diffstat (limited to 'test/functional/plugin')
-rw-r--r--test/functional/plugin/shada_spec.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua
index 5a064a759f..5a5b4df1ef 100644
--- a/test/functional/plugin/shada_spec.lua
+++ b/test/functional/plugin/shada_spec.lua
@@ -3,6 +3,7 @@ local eq, nvim_eval, nvim_command, nvim, exc_exec, funcs, nvim_feed, curbuf =
helpers.eq, helpers.eval, helpers.command, helpers.nvim, helpers.exc_exec,
helpers.funcs, helpers.feed, helpers.curbuf
local neq = helpers.neq
+local read_file = helpers.read_file
local mpack = require('mpack')
@@ -2152,9 +2153,7 @@ describe('plugin/shada.vim', function()
end)
local shada_eq = function(expected, fname_)
- local fd = io.open(fname_)
- local mpack_result = fd:read('*a')
- fd:close()
+ local mpack_result = read_file(fname_)
mpack_eq(expected, mpack_result)
end
@@ -2278,7 +2277,7 @@ describe('plugin/shada.vim', function()
' + f file name ["foo"]',
' + l line number 2',
' + c column -200',
- }, eol) .. eol, io.open(fname .. '.tst'):read('*a'))
+ }, eol) .. eol, read_file(fname .. '.tst'))
shada_eq({{
timestamp=0,
type=8,
@@ -2326,7 +2325,7 @@ describe('plugin/shada.vim', function()
'Jump with timestamp ' .. epoch .. ':',
' % Key________ Description Value',
' + n name \'A\'',
- }, eol) .. eol, io.open(fname .. '.tst'):read('*a'))
+ }, eol) .. eol, read_file(fname .. '.tst'))
shada_eq({{
timestamp=0,
type=8,
@@ -2383,7 +2382,7 @@ describe('plugin/shada.vim', function()
' + f file name ["foo"]',
' + l line number 2',
' + c column -200',
- }, eol) .. eol, io.open(fname .. '.tst'):read('*a'))
+ }, eol) .. eol, read_file(fname .. '.tst'))
shada_eq({{
timestamp=0,
type=8,