aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/008_autocommands_spec.lua
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/legacy/008_autocommands_spec.lua
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/legacy/008_autocommands_spec.lua')
-rw-r--r--test/functional/legacy/008_autocommands_spec.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/functional/legacy/008_autocommands_spec.lua b/test/functional/legacy/008_autocommands_spec.lua
index 7474f1e068..453638ce45 100644
--- a/test/functional/legacy/008_autocommands_spec.lua
+++ b/test/functional/legacy/008_autocommands_spec.lua
@@ -5,9 +5,10 @@ local helpers = require('test.functional.helpers')(after_each)
local feed, source = helpers.feed, helpers.source
local clear, feed_command, expect, eq, eval = helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.eval
local write_file, wait, dedent = helpers.write_file, helpers.wait, helpers.dedent
-local io = require('io')
+local read_file = helpers.read_file
describe('autocommands that delete and unload buffers:', function()
+ local test_file = 'Xtest-008_autocommands.out'
local text1 = dedent([[
start of Xxx1
test
@@ -18,7 +19,7 @@ describe('autocommands that delete and unload buffers:', function()
write_file('Xxx2', text2..'\n')
end)
teardown(function()
- os.remove('test.out')
+ os.remove(test_file)
os.remove('Xxx1')
os.remove('Xxx2')
end)
@@ -65,7 +66,8 @@ describe('autocommands that delete and unload buffers:', function()
endwhile
endfunc
func WriteToOut()
- edit! test.out
+ edit! ]]..test_file..[[
+
$put ='VimLeave done'
write
endfunc
@@ -86,6 +88,6 @@ describe('autocommands that delete and unload buffers:', function()
feed_command('q')
wait()
eq('VimLeave done',
- string.match(io.open('test.out', 'r'):read('*all'), "^%s*(.-)%s*$"))
+ string.match(read_file(test_file), "^%s*(.-)%s*$"))
end)
end)