diff options
author | Famiu Haque <famiuhaque@proton.me> | 2024-11-04 19:00:12 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-04 05:00:12 -0800 |
commit | a27419f3fc540f66567f4559a796cd6758f1bb1f (patch) | |
tree | ff8d1f00c01bb391facba5d239a58eb5aa07eb44 /test | |
parent | 04d178053fee7be92c8a7634a1acfe373c758638 (diff) | |
download | rneovim-a27419f3fc540f66567f4559a796cd6758f1bb1f.tar.gz rneovim-a27419f3fc540f66567f4559a796cd6758f1bb1f.tar.bz2 rneovim-a27419f3fc540f66567f4559a796cd6758f1bb1f.zip |
feat(options)!: disallow setting hidden options #28400
Problem:
There are three different ways of marking an option as hidden, `enable_if
= false`, `hidden = true` and `immutable = true`. These also have different
behaviors. Options hidden with `enable_if = false` can't have their value
fetched using Vim script or the API, but options hidden with `hidden = true` or
`immutable = true` can. On the other hand, options with `hidden = true` do not
error when trying to set their value, but options with `immutable = true` do.
Solution:
Remove `enable_if = false`, remove the `hidden` property for options, and use
`immutable = true` to mark an option as hidden instead. Also make hidden option
variable pointers always point to the default value, which allows fetching the
value of every hidden option using Vim script and the API. This does also mean
that trying to set a hidden option will now give an error instead of just being
ignored.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/lua/runtime_spec.lua | 4 | ||||
-rw-r--r-- | test/old/testdir/gen_opt_test.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_autocmd.vim | 5 | ||||
-rw-r--r-- | test/old/testdir/test_cmdline.vim | 1 | ||||
-rw-r--r-- | test/old/testdir/test_compiler.vim | 7 | ||||
-rw-r--r-- | test/old/testdir/test_expr.vim | 8 |
6 files changed, 18 insertions, 9 deletions
diff --git a/test/functional/lua/runtime_spec.lua b/test/functional/lua/runtime_spec.lua index f63363d6d9..6705dff847 100644 --- a/test/functional/lua/runtime_spec.lua +++ b/test/functional/lua/runtime_spec.lua @@ -21,7 +21,9 @@ describe('runtime:', function() exec('set rtp+=' .. plug_dir) exec([[ set shell=doesnotexist - set completeslash=slash + if exists('+completeslash') + set completeslash=slash + endif set isfname+=(,) ]]) end) diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index 51f260cc5e..532ec965d1 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -392,7 +392,7 @@ for option in options let fullname = option.full_name let shortname = get(option, 'abbreviation', fullname) - if get(option, 'immutable', v:false) + if !exists('+' .. fullname) continue endif diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index c2bba8fafc..64599c869a 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -2003,7 +2003,10 @@ func Test_Cmdline() au! CmdlineLeave let save_shellslash = &shellslash - set noshellslash + " Nvim doesn't allow setting value of a hidden option to non-default value + if exists('+shellslash') + set noshellslash + endif au! CmdlineEnter / let g:entered = expand('<afile>') au! CmdlineLeave / let g:left = expand('<afile>') let g:entered = 0 diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 0ef2c33c03..27165bb606 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -2319,6 +2319,7 @@ endfunc " Test for 'imcmdline' and 'imsearch' " This test doesn't actually test the input method functionality. func Test_cmdline_inputmethod() + throw 'Skipped: Nvim does not allow setting the value of a hidden option' new call setline(1, ['', 'abc', '']) set imcmdline diff --git a/test/old/testdir/test_compiler.vim b/test/old/testdir/test_compiler.vim index 69420b4b7f..07b57b76d9 100644 --- a/test/old/testdir/test_compiler.vim +++ b/test/old/testdir/test_compiler.vim @@ -10,9 +10,12 @@ func Test_compiler() let save_LC_ALL = $LC_ALL let $LC_ALL= "C" - " %:S does not work properly with 'shellslash' set let save_shellslash = &shellslash - set noshellslash + " Nvim doesn't allow setting value of a hidden option to non-default value + if exists('+shellslash') + " %:S does not work properly with 'shellslash' set + set noshellslash + endif e Xfoo.pl compiler perl diff --git a/test/old/testdir/test_expr.vim b/test/old/testdir/test_expr.vim index 58a385cba8..56a4c3bffa 100644 --- a/test/old/testdir/test_expr.vim +++ b/test/old/testdir/test_expr.vim @@ -799,10 +799,10 @@ func Test_expr_completion() call assert_equal('"echo 1 || g:tvar1 g:tvar2', @:) " completion for options - call feedkeys(":echo &compat\<C-A>\<C-B>\"\<CR>", 'xt') - call assert_equal('"echo &compatible', @:) - call feedkeys(":echo 1 && &compat\<C-A>\<C-B>\"\<CR>", 'xt') - call assert_equal('"echo 1 && &compatible', @:) + "call feedkeys(":echo &compat\<C-A>\<C-B>\"\<CR>", 'xt') + "call assert_equal('"echo &compatible', @:) + "call feedkeys(":echo 1 && &compat\<C-A>\<C-B>\"\<CR>", 'xt') + "call assert_equal('"echo 1 && &compatible', @:) call feedkeys(":echo &g:equala\<C-A>\<C-B>\"\<CR>", 'xt') call assert_equal('"echo &g:equalalways', @:) |