diff src/testdir/test_options.vim @ 20148:fadb7f84beff v8.2.0629

patch 8.2.0629: setting a boolean option to v:false does not work Commit: https://github.com/vim/vim/commit/65d032c779a43b767497e15e6a32d04a6a8fa65d Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 24 20:57:01 2020 +0200 patch 8.2.0629: setting a boolean option to v:false does not work Problem: Setting a boolean option to v:false does not work. Solution: Do not use the string representation of the value. (Christian Brabandt, closes #5974)
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 Apr 2020 21:00:04 +0200
parents d13f8ae3b1de
children 244eb8d8d100
line wrap: on
line diff
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -899,4 +899,18 @@ func Test_opt_num_op()
   set shiftwidth&
 endfunc
 
+" Test for setting option values using v:false and v:true
+func Test_opt_boolean()
+  set number&
+  set number
+  call assert_equal(1, &nu)
+  set nonu
+  call assert_equal(0, &nu)
+  let &nu = v:true
+  call assert_equal(1, &nu)
+  let &nu = v:false
+  call assert_equal(0, &nu)
+  set number&
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab