diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-06 20:29:28 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-06 20:29:28 +0100 |
commit | 3712792637516aea7acf76a11533be1066952820 (patch) | |
tree | 513e92becf8e22c92f065f08f9316c3ff0480619 | |
parent | 81e7a9c3fb37cad46c8f04a5ce871fb06819a371 (diff) | |
download | vim-git-7.4.1271.tar.gz |
patch 7.4.1271v7.4.1271
Problem: assert_false(v:false) reports an error. (Nikolai Pavlov)
Solution: Recognize v:true and v:false. (Closes #625)
-rw-r--r-- | src/eval.c | 3 | ||||
-rw-r--r-- | src/testdir/test_assert.vim | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 7 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index 7ce739ce7..1c2bd61aa 100644 --- a/src/eval.c +++ b/src/eval.c @@ -9216,6 +9216,9 @@ assert_bool(typval_T *argvars, int isTrue) int error = FALSE; garray_T ga; + if (argvars[0].v_type == VAR_SPECIAL + && argvars[0].vval.v_number == (isTrue ? VVAL_TRUE : VV_FALSE)) + return; if (argvars[0].v_type != VAR_NUMBER || (get_tv_number_chk(&argvars[0], &error) == 0) == isTrue || error) diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim index 22046e2b8..6d2f80094 100644 --- a/src/testdir/test_assert.vim +++ b/src/testdir/test_assert.vim @@ -2,11 +2,13 @@ func Test_assert_false() call assert_false(0) + call assert_false(v:false) endfunc func Test_assert_true() call assert_true(1) call assert_true(123) + call assert_true(v:true) endfunc func Test_assert_equal() diff --git a/src/version.c b/src/version.c index 74518d936..471bd343c 100644 --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1271, +/**/ 1270, /**/ 1269, |