aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
commit1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch)
treecd08258054db80bb9a11b1061bb091c70b76926a /test/functional/legacy
parenteaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-aucmd_textputpost.tar.gz
rneovim-aucmd_textputpost.tar.bz2
rneovim-aucmd_textputpost.zip
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua6
-rw-r--r--test/functional/legacy/012_directory_spec.lua28
-rw-r--r--test/functional/legacy/061_undo_tree_spec.lua17
-rw-r--r--test/functional/legacy/074_global_var_in_viminfo_spec.lua4
-rw-r--r--test/functional/legacy/088_conceal_tabs_spec.lua97
-rw-r--r--test/functional/legacy/assert_spec.lua8
-rw-r--r--test/functional/legacy/autochdir_spec.lua4
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua148
-rw-r--r--test/functional/legacy/breakindent_spec.lua36
-rw-r--r--test/functional/legacy/buffer_spec.lua2
-rw-r--r--test/functional/legacy/cmdline_spec.lua25
-rw-r--r--test/functional/legacy/conceal_spec.lua587
-rw-r--r--test/functional/legacy/crash_spec.lua16
-rw-r--r--test/functional/legacy/debugger_spec.lua85
-rw-r--r--test/functional/legacy/delete_spec.lua2
-rw-r--r--test/functional/legacy/digraph_spec.lua6
-rw-r--r--test/functional/legacy/display_spec.lua190
-rw-r--r--test/functional/legacy/edit_spec.lua66
-rw-r--r--test/functional/legacy/eval_spec.lua10
-rw-r--r--test/functional/legacy/filechanged_spec.lua4
-rw-r--r--test/functional/legacy/glob2regpat_spec.lua8
-rw-r--r--test/functional/legacy/highlight_spec.lua (renamed from test/functional/legacy/051_highlight_spec.lua)34
-rw-r--r--test/functional/legacy/matchparen_spec.lua116
-rw-r--r--test/functional/legacy/memory_usage_spec.lua8
-rw-r--r--test/functional/legacy/messages_spec.lua119
-rw-r--r--test/functional/legacy/move_spec.lua49
-rw-r--r--test/functional/legacy/normal_spec.lua41
-rw-r--r--test/functional/legacy/options_spec.lua2
-rw-r--r--test/functional/legacy/prompt_buffer_spec.lua133
-rw-r--r--test/functional/legacy/put_spec.lua53
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua1193
-rw-r--r--test/functional/legacy/search_spec.lua44
-rw-r--r--test/functional/legacy/search_stat_spec.lua64
-rw-r--r--test/functional/legacy/vimscript_spec.lua2
-rw-r--r--test/functional/legacy/visual_mode_spec.lua79
-rw-r--r--test/functional/legacy/visual_spec.lua69
-rw-r--r--test/functional/legacy/window_cmd_spec.lua110
37 files changed, 3035 insertions, 430 deletions
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index 7ae851467f..5b6d030567 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -13,7 +13,7 @@
-- being modified outside of Vim (noticed on Solaris).
local helpers= require('test.functional.helpers')(after_each)
-local lfs = require('lfs')
+local luv = require('luv')
local clear, feed_command, expect, eq, neq, dedent, write_file, feed =
helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.neq,
helpers.dedent, helpers.write_file, helpers.feed
@@ -31,8 +31,8 @@ local function prepare_gz_file(name, text)
-- Compress the file with gzip.
command([[call system(['gzip', '--force', ']]..name..[['])]])
-- This should create the .gz file and delete the original.
- neq(nil, lfs.attributes(name..'.gz'))
- eq(nil, lfs.attributes(name))
+ neq(nil, luv.fs_stat(name..'.gz'))
+ eq(nil, luv.fs_stat(name))
end
describe('file reading, writing and bufnew and filter autocommands', function()
diff --git a/test/functional/legacy/012_directory_spec.lua b/test/functional/legacy/012_directory_spec.lua
index dd207ca0b4..25d0dcb81e 100644
--- a/test/functional/legacy/012_directory_spec.lua
+++ b/test/functional/legacy/012_directory_spec.lua
@@ -4,7 +4,7 @@
-- - "dir", in directory relative to current dir
local helpers = require('test.functional.helpers')(after_each)
-local lfs = require('lfs')
+local luv = require('luv')
local eq = helpers.eq
local neq = helpers.neq
@@ -15,12 +15,12 @@ local clear = helpers.clear
local insert = helpers.insert
local command = helpers.command
local write_file = helpers.write_file
-local curbufmeths = helpers.curbufmeths
local expect_exit = helpers.expect_exit
+local mkdir = helpers.mkdir
local function ls_dir_sorted(dirname)
local files = {}
- for f in lfs.dir(dirname) do
+ for f in vim.fs.dir(dirname) do
if f ~= "." and f~= ".." then
table.insert(files, f)
end
@@ -38,8 +38,8 @@ describe("'directory' option", function()
end of testfile
]]
write_file('Xtest1', text)
- lfs.mkdir('Xtest.je')
- lfs.mkdir('Xtest2')
+ mkdir('Xtest.je')
+ mkdir('Xtest2')
write_file('Xtest2/Xtest3', text)
clear()
end)
@@ -57,33 +57,33 @@ describe("'directory' option", function()
line 3 Abcdefghij
end of testfile]])
- meths.set_option('swapfile', true)
- curbufmeths.set_option('swapfile', true)
- meths.set_option('directory', '.')
+ meths.set_option_value('swapfile', true, {})
+ meths.set_option_value('swapfile', true, {})
+ meths.set_option_value('directory', '.', {})
-- sanity check: files should not exist yet.
- eq(nil, lfs.attributes('.Xtest1.swp'))
+ eq(nil, luv.fs_stat('.Xtest1.swp'))
command('edit! Xtest1')
poke_eventloop()
eq('Xtest1', funcs.buffer_name('%'))
-- Verify that the swapfile exists. In the legacy test this was done by
-- reading the output from :!ls.
- neq(nil, lfs.attributes('.Xtest1.swp'))
+ neq(nil, luv.fs_stat('.Xtest1.swp'))
- meths.set_option('directory', './Xtest2,.')
+ meths.set_option_value('directory', './Xtest2,.', {})
command('edit Xtest1')
poke_eventloop()
-- swapfile should no longer exist in CWD.
- eq(nil, lfs.attributes('.Xtest1.swp'))
+ eq(nil, luv.fs_stat('.Xtest1.swp'))
eq({ "Xtest1.swp", "Xtest3" }, ls_dir_sorted("Xtest2"))
- meths.set_option('directory', 'Xtest.je')
+ meths.set_option_value('directory', 'Xtest.je', {})
command('bdelete')
command('edit Xtest2/Xtest3')
- eq(true, curbufmeths.get_option('swapfile'))
+ eq(true, meths.get_option_value('swapfile', {}))
poke_eventloop()
eq({ "Xtest3" }, ls_dir_sorted("Xtest2"))
diff --git a/test/functional/legacy/061_undo_tree_spec.lua b/test/functional/legacy/061_undo_tree_spec.lua
index 1a8ef067d0..b5af8f7d52 100644
--- a/test/functional/legacy/061_undo_tree_spec.lua
+++ b/test/functional/legacy/061_undo_tree_spec.lua
@@ -22,29 +22,30 @@ end
describe('undo tree:', function()
before_each(clear)
+ local fname = 'Xtest_functional_legacy_undotree'
teardown(function()
- os.remove('Xtest.source')
+ os.remove(fname .. '.source')
end)
describe(':earlier and :later', function()
before_each(function()
- os.remove('Xtest')
+ os.remove(fname)
end)
teardown(function()
- os.remove('Xtest')
+ os.remove(fname)
end)
it('time specifications, g- g+', function()
-- We write the test text to a file in order to prevent nvim to record
-- the inserting of the text into the undo history.
- write_file('Xtest', '\n123456789\n')
+ write_file(fname, '\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
-- function to allow multiple attempts.
local function test_earlier_later()
clear()
- feed_command('e Xtest')
+ feed_command('e ' .. fname)
-- Assert that no undo history is present.
eq({}, eval('undotree().entries'))
-- Delete three characters and undo.
@@ -103,7 +104,7 @@ describe('undo tree:', function()
it('file-write specifications', function()
feed('ione one one<esc>')
- feed_command('w Xtest')
+ feed_command('w ' .. fname)
feed('otwo<esc>')
feed('otwo<esc>')
feed_command('w')
@@ -187,7 +188,7 @@ describe('undo tree:', function()
it('undo an expression-register', function()
local normal_commands = 'o1\027a2\018=string(123)\n\027'
- write_file('Xtest.source', normal_commands)
+ write_file(fname .. '.source', normal_commands)
feed('oa<esc>')
feed('ob<esc>')
@@ -221,7 +222,7 @@ describe('undo tree:', function()
c
12]])
feed('od<esc>')
- feed_command('so! Xtest.source')
+ feed_command('so! ' .. fname .. '.source')
expect([[
a
diff --git a/test/functional/legacy/074_global_var_in_viminfo_spec.lua b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
index 445d742c1f..06d8b276d7 100644
--- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua
+++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
@@ -1,7 +1,7 @@
-- Tests for storing global variables in the .shada file
local helpers = require('test.functional.helpers')(after_each)
-local lfs = require('lfs')
+local luv = require('luv')
local clear, command, eq, neq, eval, poke_eventloop =
helpers.clear, helpers.command, helpers.eq, helpers.neq, helpers.eval,
helpers.poke_eventloop
@@ -39,7 +39,7 @@ describe('storing global variables in ShaDa files', function()
poke_eventloop()
-- Assert that the shada file exists.
- neq(nil, lfs.attributes(tempname))
+ neq(nil, luv.fs_stat(tempname))
command('unlet MY_GLOBAL_DICT')
command('unlet MY_GLOBAL_LIST')
-- Assert that the variables where deleted.
diff --git a/test/functional/legacy/088_conceal_tabs_spec.lua b/test/functional/legacy/088_conceal_tabs_spec.lua
deleted file mode 100644
index a4c7e26583..0000000000
--- a/test/functional/legacy/088_conceal_tabs_spec.lua
+++ /dev/null
@@ -1,97 +0,0 @@
--- Tests for correct display (cursor column position) with +conceal and
--- tabulators.
-
-local helpers = require('test.functional.helpers')(after_each)
-local feed, insert, clear, feed_command =
- helpers.feed, helpers.insert, helpers.clear, helpers.feed_command
-
-local expect_pos = function(row, col)
- return helpers.eq({row, col}, helpers.eval('[screenrow(), screencol()]'))
-end
-
-describe('cursor and column position with conceal and tabulators', function()
- setup(clear)
-
- -- luacheck: ignore 621 (Indentation)
- it('are working', function()
- insert([[
- start:
- .concealed. text
- |concealed| text
-
- .concealed. text
- |concealed| text
-
- .a. .b. .c. .d.
- |a| |b| |c| |d|]])
-
- -- Conceal settings.
- feed_command('set conceallevel=2')
- feed_command('set concealcursor=nc')
- feed_command('syntax match test /|/ conceal')
- -- Start test.
- feed_command('/^start:')
- feed('ztj')
- expect_pos(2, 1)
- -- We should end up in the same column when running these commands on the
- -- two lines.
- feed('ft')
- expect_pos(2, 17)
- feed('$')
- expect_pos(2, 20)
- feed('0j')
- expect_pos(3, 1)
- feed('ft')
- expect_pos(3, 17)
- feed('$')
- expect_pos(3, 20)
- feed('j0j')
- expect_pos(5, 8)
- -- Same for next test block.
- feed('ft')
- expect_pos(5, 25)
- feed('$')
- expect_pos(5, 28)
- feed('0j')
- expect_pos(6, 8)
- feed('ft')
- expect_pos(6, 25)
- feed('$')
- expect_pos(6, 28)
- feed('0j0j')
- expect_pos(8, 1)
- -- And check W with multiple tabs and conceals in a line.
- feed('W')
- expect_pos(8, 9)
- feed('W')
- expect_pos(8, 17)
- feed('W')
- expect_pos(8, 25)
- feed('$')
- expect_pos(8, 27)
- feed('0j')
- expect_pos(9, 1)
- feed('W')
- expect_pos(9, 9)
- feed('W')
- expect_pos(9, 17)
- feed('W')
- expect_pos(9, 25)
- feed('$')
- expect_pos(9, 26)
- feed_command('set lbr')
- feed('$')
- expect_pos(9, 26)
- feed_command('set list listchars=tab:>-')
- feed('0')
- expect_pos(9, 1)
- feed('W')
- expect_pos(9, 9)
- feed('W')
- expect_pos(9, 17)
- feed('W')
- expect_pos(9, 25)
- feed('$')
- expect_pos(9, 26)
- end)
-end)
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua
index 4829a0bbe1..d49d7d665a 100644
--- a/test/functional/legacy/assert_spec.lua
+++ b/test/functional/legacy/assert_spec.lua
@@ -145,10 +145,10 @@ describe('assert function:', function()
call assert_true('', 'file two')
]])
expected_errors({
- "nvim_exec(): equal assertion failed: Expected 1 but got 100",
- "nvim_exec(): true assertion failed: Expected False but got 'true'",
- "nvim_exec(): false assertion failed: Expected True but got 'false'",
- "nvim_exec(): file two: Expected True but got ''",
+ "nvim_exec2(): equal assertion failed: Expected 1 but got 100",
+ "nvim_exec2(): true assertion failed: Expected False but got 'true'",
+ "nvim_exec2(): false assertion failed: Expected True but got 'false'",
+ "nvim_exec2(): file two: Expected True but got ''",
})
end)
end)
diff --git a/test/functional/legacy/autochdir_spec.lua b/test/functional/legacy/autochdir_spec.lua
index 13cb6cd287..5da54b4850 100644
--- a/test/functional/legacy/autochdir_spec.lua
+++ b/test/functional/legacy/autochdir_spec.lua
@@ -1,8 +1,8 @@
-local lfs = require('lfs')
local helpers = require('test.functional.helpers')(after_each)
local clear, eq, matches = helpers.clear, helpers.eq, helpers.matches
local eval, command, call, meths = helpers.eval, helpers.command, helpers.call, helpers.meths
local source, exec_capture = helpers.source, helpers.exec_capture
+local mkdir = helpers.mkdir
local function expected_empty()
eq({}, meths.get_vvar('errors'))
@@ -12,7 +12,7 @@ describe('autochdir behavior', function()
local dir = 'Xtest_functional_legacy_autochdir'
before_each(function()
- lfs.mkdir(dir)
+ mkdir(dir)
clear()
command('set shellslash')
end)
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index e00b468c16..6034d13e2a 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -48,10 +48,10 @@ end
local function expected_table(option, oldval, oldval_l, oldval_g, newval, scope, cmd, attr)
return {
option = option,
- oldval = tostring(oldval),
- oldval_l = tostring(oldval_l),
- oldval_g = tostring(oldval_g),
- newval = tostring(newval),
+ oldval = oldval,
+ oldval_l = oldval_l,
+ oldval_g = oldval_g,
+ newval = newval,
scope = scope,
cmd = cmd,
attr = attr,
@@ -129,44 +129,44 @@ describe('au OptionSet', function()
it('should be called in setting number option', function()
command('set nu')
- expected_combination({'number', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'number', false, false, false, true, 'global', 'set'})
command('setlocal nonu')
- expected_combination({'number', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'number', true, true, '', false, 'local', 'setlocal'})
command('setglobal nonu')
- expected_combination({'number', 1, '', 1, 0, 'global', 'setglobal'})
+ expected_combination({'number', true, '', true, false, 'global', 'setglobal'})
end)
it('should be called in setting autoindent option',function()
command('setlocal ai')
- expected_combination({'autoindent', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'autoindent', false, false, '', true, 'local', 'setlocal'})
command('setglobal ai')
- expected_combination({'autoindent', 0, '', 0, 1, 'global', 'setglobal'})
+ expected_combination({'autoindent', false, '', false, true, 'global', 'setglobal'})
command('set noai')
- expected_combination({'autoindent', 1, 1, 1, 0, 'global', 'set'})
+ expected_combination({'autoindent', true, true, true, false, 'global', 'set'})
end)
it('should be called in inverting global autoindent option',function()
command('set ai!')
- expected_combination({'autoindent', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'autoindent', false, false, false, true, 'global', 'set'})
end)
it('should be called in being unset local autoindent option',function()
command('setlocal ai')
- expected_combination({'autoindent', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'autoindent', false, false, '', true, 'local', 'setlocal'})
command('setlocal ai<')
- expected_combination({'autoindent', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'autoindent', true, true, '', false, 'local', 'setlocal'})
end)
it('should be called in setting global list and number option at the same time',function()
command('set list nu')
expected_combination(
- {'list', 0, 0, 0, 1, 'global', 'set'},
- {'number', 0, 0, 0, 1, 'global', 'set'}
+ {'list', false, false, false, true, 'global', 'set'},
+ {'number', false, false, false, true, 'global', 'set'}
)
end)
@@ -177,20 +177,20 @@ describe('au OptionSet', function()
it('should be called in setting local acd', function()
command('setlocal acd')
- expected_combination({'autochdir', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'autochdir', false, false, '', true, 'local', 'setlocal'})
end)
it('should be called in setting autoread', function()
command('set noar')
- expected_combination({'autoread', 1, 1, 1, 0, 'global', 'set'})
+ expected_combination({'autoread', true, true, true, false, 'global', 'set'})
command('setlocal ar')
- expected_combination({'autoread', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'autoread', false, false, '', true, 'local', 'setlocal'})
end)
it('should be called in inverting global autoread', function()
command('setglobal invar')
- expected_combination({'autoread', 1, '', 1, 0, 'global', 'setglobal'})
+ expected_combination({'autoread', true, '', true, false, 'global', 'setglobal'})
end)
it('should be called in setting backspace option through :let', function()
@@ -208,7 +208,7 @@ describe('au OptionSet', function()
it('should trigger using correct option name', function()
command('call setbufvar(1, "&backup", 1)')
- expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'backup', false, false, '', true, 'local', 'setlocal'})
end)
it('should trigger if the current buffer is different from the targeted buffer', function()
@@ -260,7 +260,7 @@ describe('au OptionSet', function()
command('setlocal tags=tagpath2')
expected_combination({'tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal'})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal tags=tag_global')
command('noa setlocal tags=tag_local')
@@ -269,12 +269,12 @@ describe('au OptionSet', function()
'tags', 'tag_global', 'tag_local', 'tag_global', 'tagpath', 'global', 'set'
})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa set tags=tag_global')
command('noa setlocal tags=')
command('set tags=tagpath')
- expected_combination({'tags', 'tag_global', '', 'tag_global', 'tagpath', 'global', 'set'})
+ expected_combination({'tags', 'tag_global', 'tag_global', 'tag_global', 'tagpath', 'global', 'set'})
end)
it('with string local (to buffer) option', function()
@@ -295,7 +295,7 @@ describe('au OptionSet', function()
command('setlocal spelllang=klingon')
expected_combination({'spelllang', oldval, oldval, '', 'klingon', 'local', 'setlocal'})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal spelllang=spellglobal')
command('noa setlocal spelllang=spelllocal')
@@ -311,7 +311,7 @@ describe('au OptionSet', function()
command('set statusline=foo')
expected_combination({'statusline', oldval, oldval, '', 'foo', 'global', 'set'})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('set statusline&')
expected_combination({'statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set'})
@@ -323,7 +323,7 @@ describe('au OptionSet', function()
command('setlocal statusline=baz')
expected_combination({'statusline', oldval, oldval, '', 'baz', 'local', 'setlocal'})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal statusline=bar')
command('noa setlocal statusline=baz')
@@ -364,11 +364,15 @@ describe('au OptionSet', function()
command('setlocal cmdheight=2')
expected_combination({'cmdheight', 1, 1, '', 2, 'local', 'setlocal'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa setglobal cmdheight=8')
command('noa setlocal cmdheight=1') -- Sets the global(!) value
command('set cmdheight=2')
expected_combination({'cmdheight', 1, 1, 1, 2, 'global', 'set'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa set cmdheight=8')
command('set cmdheight=2')
expected_combination({'cmdheight', 8, 8, 8, 2, 'global', 'set'})
@@ -385,11 +389,15 @@ describe('au OptionSet', function()
command('setlocal undolevels=2')
expected_combination({'undolevels', 1, 1, '', 2, 'local', 'setlocal'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa setglobal undolevels=8')
command('noa setlocal undolevels=1')
command('set undolevels=2')
- expected_combination({'undolevels', 1, 1, 8, 2, 'global', 'set'})
+ expected_combination({'undolevels', 8, 1, 8, 2, 'global', 'set'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa set undolevels=8')
command('set undolevels=2')
expected_combination({'undolevels', 8, 8, 8, 2, 'global', 'set'})
@@ -427,11 +435,15 @@ describe('au OptionSet', function()
command('setlocal scrolloff=2')
expected_combination({'scrolloff', 1, 1, '', 2, 'local', 'setlocal'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa setglobal scrolloff=8')
command('noa setlocal scrolloff=1')
command('set scrolloff=2')
- expected_combination({'scrolloff', 1, 1, 8, 2, 'global', 'set'})
+ expected_combination({'scrolloff', 8, 1, 8, 2, 'global', 'set'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa set scrolloff=8')
command('set scrolloff=2')
expected_combination({'scrolloff', 8, 8, 8, 2, 'global', 'set'})
@@ -441,114 +453,111 @@ describe('au OptionSet', function()
command('noa setglobal foldcolumn=8')
command('noa setlocal foldcolumn=1')
command('setglobal foldcolumn=2')
- expected_combination({'foldcolumn', 8, '', 8, 2, 'global', 'setglobal'})
+ expected_combination({'foldcolumn', '8', '', '8', '2', 'global', 'setglobal'})
command('noa setglobal foldcolumn=8')
command('noa setlocal foldcolumn=1')
command('setlocal foldcolumn=2')
- expected_combination({'foldcolumn', 1, 1, '', 2, 'local', 'setlocal'})
+ expected_combination({'foldcolumn', '1', '1', '', '2', 'local', 'setlocal'})
command('noa setglobal foldcolumn=8')
command('noa setlocal foldcolumn=1')
command('set foldcolumn=2')
- expected_combination({'foldcolumn', 1, 1, 8, 2, 'global', 'set'})
+ expected_combination({'foldcolumn', '1', '1', '8', '2', 'global', 'set'})
command('noa set foldcolumn=8')
command('set foldcolumn=2')
- expected_combination({'foldcolumn', 8, 8, 8, 2, 'global', 'set'})
+ expected_combination({'foldcolumn', '8', '8', '8', '2', 'global', 'set'})
end)
it('with boolean global option', function()
command('noa setglobal nowrapscan')
command('noa setlocal wrapscan') -- Sets the global(!) value
command('setglobal nowrapscan')
- expected_combination({'wrapscan', 1, '', 1, 0, 'global', 'setglobal'})
+ expected_combination({'wrapscan', true, '', true, false, 'global', 'setglobal'})
command('noa setglobal nowrapscan')
command('noa setlocal wrapscan') -- Sets the global(!) value
command('setlocal nowrapscan')
- expected_combination({'wrapscan', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'wrapscan', true, true, '', false, 'local', 'setlocal'})
command('noa setglobal nowrapscan')
command('noa setlocal wrapscan') -- Sets the global(!) value
command('set nowrapscan')
- expected_combination({'wrapscan', 1, 1, 1, 0, 'global', 'set'})
+ expected_combination({'wrapscan', true, true, true, false, 'global', 'set'})
command('noa set nowrapscan')
command('set wrapscan')
- expected_combination({'wrapscan', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'wrapscan', false, false, false, true, 'global', 'set'})
end)
it('with boolean global-local (to buffer) option', function()
command('noa setglobal noautoread')
command('noa setlocal autoread')
command('setglobal autoread')
- expected_combination({'autoread', 0, '', 0, 1, 'global', 'setglobal'})
+ expected_combination({'autoread', false, '', false, true, 'global', 'setglobal'})
command('noa setglobal noautoread')
command('noa setlocal autoread')
command('setlocal noautoread')
- expected_combination({'autoread', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'autoread', true, true, '', false, 'local', 'setlocal'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa setglobal noautoread')
command('noa setlocal autoread')
command('set autoread')
- expected_combination({'autoread', 1, 1, 0, 1, 'global', 'set'})
+ expected_combination({'autoread', false, true, false, true, 'global', 'set'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa set noautoread')
command('set autoread')
- expected_combination({'autoread', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'autoread', false, false, false, true, 'global', 'set'})
end)
it('with boolean local (to buffer) option', function()
command('noa setglobal nocindent')
command('noa setlocal cindent')
command('setglobal cindent')
- expected_combination({'cindent', 0, '', 0, 1, 'global', 'setglobal'})
+ expected_combination({'cindent', false, '', false, true, 'global', 'setglobal'})
command('noa setglobal nocindent')
command('noa setlocal cindent')
command('setlocal nocindent')
- expected_combination({'cindent', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'cindent', true, true, '',