aboutsummaryrefslogtreecommitdiff
path: root/test/functional/shada
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-02-11 18:25:01 +0800
committerGitHub <noreply@github.com>2023-02-11 18:25:01 +0800
commit7d58de11f49c574a8a305e28e96b9ff810493012 (patch)
treea3fc6cd9cbb6e689d7f1bd1be776f493ee3802b8 /test/functional/shada
parent4be6c6cf0ddf5e31d4103cb5df06651ba6f4897b (diff)
downloadrneovim-7d58de11f49c574a8a305e28e96b9ff810493012.tar.gz
rneovim-7d58de11f49c574a8a305e28e96b9ff810493012.tar.bz2
rneovim-7d58de11f49c574a8a305e28e96b9ff810493012.zip
fix(rpc)!: preseve files when stdio channel is closed (#22137)
BREAKING CHANGE: Unsaved changes are now preserved rather than discarded when stdio channel is closed.
Diffstat (limited to 'test/functional/shada')
-rw-r--r--test/functional/shada/helpers.lua1
-rw-r--r--test/functional/shada/history_spec.lua1
-rw-r--r--test/functional/shada/shada_spec.lua38
3 files changed, 21 insertions, 19 deletions
diff --git a/test/functional/shada/helpers.lua b/test/functional/shada/helpers.lua
index fb3ec4a87c..cd99d38345 100644
--- a/test/functional/shada/helpers.lua
+++ b/test/functional/shada/helpers.lua
@@ -33,6 +33,7 @@ local function reset(o)
end
local clear = function()
+ helpers.expect_exit(helpers.command, 'qall!')
os.remove(tmpname)
end
diff --git a/test/functional/shada/history_spec.lua b/test/functional/shada/history_spec.lua
index d1daf6c7cc..aa4106ad63 100644
--- a/test/functional/shada/history_spec.lua
+++ b/test/functional/shada/history_spec.lua
@@ -32,7 +32,6 @@ describe('ShaDa support code', function()
nvim_command('rshada')
eq('" Test 2', funcs.histget(':', -1))
eq('" Test', funcs.histget(':', -2))
- expect_exit(nvim_command, 'qall')
end)
it('respects &history when dumping',
diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua
index 7b1ce5d0ca..24bd363e95 100644
--- a/test/functional/shada/shada_spec.lua
+++ b/test/functional/shada/shada_spec.lua
@@ -136,24 +136,6 @@ describe('ShaDa support code', function()
eq(#msgpack, found)
end)
- it('does not write NONE file', function()
- local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed',
- '--headless', '--cmd', 'qall'}, true)
- session:close()
- eq(nil, lfs.attributes('NONE'))
- eq(nil, lfs.attributes('NONE.tmp.a'))
- end)
-
- it('does not read NONE file', function()
- write_file('NONE', '\005\001\015\131\161na\162rX\194\162rc\145\196\001-')
- local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed',
- '--headless'}, true)
- set_session(session)
- eq('', funcs.getreg('a'))
- session:close()
- os.remove('NONE')
- end)
-
local marklike = {[7]=true, [8]=true, [10]=true, [11]=true}
local find_file = function(fname)
local found = {}
@@ -263,3 +245,23 @@ describe('ShaDa support code', function()
meths.set_option('shada', '')
end)
end)
+
+describe('ShaDa support code', function()
+ it('does not write NONE file', function()
+ local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed',
+ '--headless', '--cmd', 'qall'}, true)
+ session:close()
+ eq(nil, lfs.attributes('NONE'))
+ eq(nil, lfs.attributes('NONE.tmp.a'))
+ end)
+
+ it('does not read NONE file', function()
+ write_file('NONE', '\005\001\015\131\161na\162rX\194\162rc\145\196\001-')
+ local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed',
+ '--headless'}, true)
+ set_session(session)
+ eq('', funcs.getreg('a'))
+ session:close()
+ os.remove('NONE')
+ end)
+end)