From 7311fb7cadff49422a15d3a40d7014000c8f4385 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 19 Oct 2017 17:26:03 -0400 Subject: win: enable more functional tests - plugin/shada_spec.lua: Use \r\n as Windows EOL for tests on BufWriteCmd, FileWriteCmd, FileAppendCmd. Alternative is 'set fileformat=unix'. --- test/functional/plugin/shada_spec.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/functional/plugin/shada_spec.lua') diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index dbc78e63f0..57891a8229 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -43,8 +43,6 @@ local wshada, _, fname = get_shada_rw('Xtest-functional-plugin-shada.shada') local wshada_tmp, _, fname_tmp = get_shada_rw('Xtest-functional-plugin-shada.shada.tmp.f') -if helpers.pending_win32(pending) then return end - describe('In autoload/shada.vim', function() local epoch = os.date('%Y-%m-%dT%H:%M:%S', 0) before_each(function() @@ -2140,6 +2138,7 @@ end) describe('In plugin/shada.vim', function() local epoch = os.date('%Y-%m-%dT%H:%M:%S', 0) + local eol = helpers.iswin() and '\r\n' or '\n' before_each(function() reset() os.remove(fname) @@ -2279,7 +2278,7 @@ describe('In plugin/shada.vim', function() ' + f file name ["foo"]', ' + l line number 2', ' + c column -200', - }, '\n') .. '\n', io.open(fname .. '.tst'):read('*a')) + }, eol) .. eol, io.open(fname .. '.tst'):read('*a')) shada_eq({{ timestamp=0, type=8, @@ -2303,6 +2302,7 @@ describe('In plugin/shada.vim', function() describe('event FileWriteCmd', function() it('works', function() + if helpers.pending_win32(pending) then return end nvim('set_var', 'shada#add_own_header', 0) curbuf('set_lines', 0, 1, true, { 'Jump with timestamp ' .. epoch .. ':', @@ -2326,7 +2326,7 @@ describe('In plugin/shada.vim', function() 'Jump with timestamp ' .. epoch .. ':', ' % Key________ Description Value', ' + n name \'A\'', - }, '\n') .. '\n', io.open(fname .. '.tst'):read('*a')) + }, eol) .. eol, io.open(fname .. '.tst'):read('*a')) shada_eq({{ timestamp=0, type=8, @@ -2383,7 +2383,7 @@ describe('In plugin/shada.vim', function() ' + f file name ["foo"]', ' + l line number 2', ' + c column -200', - }, '\n') .. '\n', io.open(fname .. '.tst'):read('*a')) + }, eol) .. eol, io.open(fname .. '.tst'):read('*a')) shada_eq({{ timestamp=0, type=8, -- cgit From f8010ea3eca77961312afeb96234678447ce17e4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 1 Feb 2018 03:12:37 +0100 Subject: 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 --- test/functional/plugin/shada_spec.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'test/functional/plugin/shada_spec.lua') 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, -- cgit