Mercurial > vim
changeset 9395:beab399e3883 v7.4.1979
commit https://github.com/vim/vim/commit/2acfbed9dbea990f129535de7ff3df360365130b
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 1 23:14:02 2016 +0200
patch 7.4.1979
Problem: Getting value of binary option is wrong. (Kent Sibilev)
Solution: Fix type cast. Add a test.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 01 Jul 2016 23:15:04 +0200 |
parents | bea9958b35a9 |
children | 259fa11b4aaa |
files | src/option.c src/testdir/test_expr.vim src/version.c |
diffstat | 3 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/option.c +++ b/src/option.c @@ -9102,7 +9102,7 @@ get_option_value( if ((int *)varp == &curbuf->b_changed) *numval = curbufIsChanged(); else - *numval = (long) *(varnumber_T *)varp; + *numval = (long) *(int *)varp; } return 1; }
--- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -106,3 +106,26 @@ func Test_special_char() " The failure is only visible using valgrind. call assert_fails('echo "\<C-">') endfunc + +func Test_option_value() + " boolean + set bri + call assert_equal(1, &bri) + set nobri + call assert_equal(0, &bri) + + " number + set ts=1 + call assert_equal(1, &ts) + set ts=8 + call assert_equal(8, &ts) + + " string + exe "set cedit=\<Esc>" + call assert_equal("\<Esc>", &cedit) + set cpo= + call assert_equal("", &cpo) + set cpo=abcdefgi + call assert_equal("abcdefgi", &cpo) + set cpo&vim +endfunc