mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
tests: Use new write_file() function in tests.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
-- Tests for undo tree and :earlier and :later.
|
||||
|
||||
local helpers = require('test.functional.helpers')
|
||||
local feed, insert, source, eq, eval, clear, execute, expect, wait =
|
||||
helpers.feed, helpers.insert, helpers.source, helpers.eq, helpers.eval,
|
||||
helpers.clear, helpers.execute, helpers.expect, helpers.wait
|
||||
local feed, insert, source, eq, eval, clear, execute, expect, wait, write_file
|
||||
= helpers.feed, helpers.insert, helpers.source, helpers.eq, helpers.eval,
|
||||
helpers.clear, helpers.execute, helpers.expect, helpers.wait,
|
||||
helpers.write_file
|
||||
|
||||
local function expect_empty_buffer()
|
||||
-- The space will be removed by helpers.dedent but is needed because dedent
|
||||
@@ -13,12 +14,6 @@ end
|
||||
local function expect_line(line)
|
||||
return eq(line, eval('getline(".")'))
|
||||
end
|
||||
local function write_file(name, text)
|
||||
local file = io.open(name, 'w')
|
||||
file:write(text)
|
||||
file:flush()
|
||||
file:close()
|
||||
end
|
||||
|
||||
describe('undo tree:', function()
|
||||
before_each(clear)
|
||||
@@ -40,7 +35,7 @@ describe('undo tree:', function()
|
||||
write_file('Xtest', '\n123456789\n')
|
||||
|
||||
-- `:earlier` and `:later` are (obviously) time-sensitive, so this test
|
||||
-- sometimes fails if the system is under load. It is wrapped in a local
|
||||
-- sometimes fails if the system is under load. It is wrapped in a local
|
||||
-- function to allow multiple attempts.
|
||||
local function test_earlier_later()
|
||||
clear()
|
||||
|
||||
Reference in New Issue
Block a user