diff options
| author | Famiu Haque <famiuhaque@proton.me> | 2024-10-25 20:10:40 +0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-25 07:10:40 -0700 |
| commit | b922b7d6d7889cce863540df7b0da7d512f8a2a1 (patch) | |
| tree | d1b8fdd604c7ddf3d0d301ddc9beccfff6030f18 /test | |
| parent | 01739d4673eecad0631f874ba279c5c362aa1766 (diff) | |
| download | rneovim-b922b7d6d7889cce863540df7b0da7d512f8a2a1.tar.gz rneovim-b922b7d6d7889cce863540df7b0da7d512f8a2a1.tar.bz2 rneovim-b922b7d6d7889cce863540df7b0da7d512f8a2a1.zip | |
refactor(options)!: use OptVal for option defaults #26691
Problem: We use `void *` for option default values, which is confusing and can cause problems with type-correctness. It also doesn't accomodate for multitype options. On top of that, it also leads to default boolean option values not behaving correctly on big endian systems.
Solution: Use `OptVal` for option default values.
BREAKING CHANGE:
- `:set {option}<` removes the local value for all global-local options instead of just string global-local options.
- `:setlocal {option}<` copies the global value to the local value for number and boolean global-local options instead of removing the local value.
Diffstat (limited to 'test')
| -rw-r--r-- | test/old/testdir/test_options.vim | 34 | ||||
| -rw-r--r-- | test/old/testdir/test_undo.vim | 3 |
2 files changed, 20 insertions, 17 deletions
diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index ccc7abe2d8..ba93778404 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -1386,7 +1386,8 @@ func Test_local_scrolloff() call assert_equal(5, &so) wincmd w call assert_equal(3, &so) - setlocal so< + "setlocal so< + set so< call assert_equal(5, &so) setglob so=8 call assert_equal(8, &so) @@ -1403,7 +1404,8 @@ func Test_local_scrolloff() call assert_equal(7, &siso) wincmd w call assert_equal(3, &siso) - setlocal siso< + "setlocal siso< + set siso< call assert_equal(7, &siso) setglob siso=4 call assert_equal(4, &siso) @@ -1595,17 +1597,17 @@ func Test_set_number_global_local_option() call assert_equal(12, &l:scrolloff) call assert_equal(12, &scrolloff) - " :set {option}< set the effective value of {option} to its global value. - set scrolloff< - " Nvim: local value is removed - " call assert_equal(10, &l:scrolloff) - call assert_equal(-1, &l:scrolloff) + " :setlocal {option}< set the effective value of {option} to its global value. + "set scrolloff< + setlocal scrolloff< + call assert_equal(10, &l:scrolloff) call assert_equal(10, &scrolloff) - " :setlocal {option}< removes the local value, so that the global value will be used. + " :set {option}< removes the local value, so that the global value will be used. setglobal scrolloff=15 setlocal scrolloff=18 - setlocal scrolloff< + "setlocal scrolloff< + set scrolloff< call assert_equal(-1, &l:scrolloff) call assert_equal(15, &scrolloff) @@ -1620,17 +1622,17 @@ func Test_set_boolean_global_local_option() call assert_equal(0, &l:autoread) call assert_equal(0, &autoread) - " :set {option}< set the effective value of {option} to its global value. - set autoread< - " Nvim: local value is removed - " call assert_equal(1, &l:autoread) - call assert_equal(-1, &l:autoread) + " :setlocal {option}< set the effective value of {option} to its global value. + "set autoread< + setlocal autoread< + call assert_equal(1, &l:autoread) call assert_equal(1, &autoread) - " :setlocal {option}< removes the local value, so that the global value will be used. + " :set {option}< removes the local value, so that the global value will be used. setglobal noautoread setlocal autoread - setlocal autoread< + "setlocal autoread< + set autoread< call assert_equal(-1, &l:autoread) call assert_equal(0, &autoread) diff --git a/test/old/testdir/test_undo.vim b/test/old/testdir/test_undo.vim index a207f4f4e0..d876277850 100644 --- a/test/old/testdir/test_undo.vim +++ b/test/old/testdir/test_undo.vim @@ -187,7 +187,8 @@ func Test_global_local_undolevels() " Resetting the local 'undolevels' value to use the global value setlocal undolevels=5 - setlocal undolevels< + "setlocal undolevels< + set undolevels< call assert_equal(-123456, &l:undolevels) " Drop created windows |