Skip to content

Commit 3712792

Browse files
committed
patch 7.4.1271
Problem: assert_false(v:false) reports an error. (Nikolai Pavlov) Solution: Recognize v:true and v:false. (Closes #625)
1 parent 81e7a9c commit 3712792

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/eval.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9216,6 +9216,9 @@ assert_bool(typval_T *argvars, int isTrue)
92169216
int error = FALSE;
92179217
garray_T ga;
92189218

9219+
if (argvars[0].v_type == VAR_SPECIAL
9220+
&& argvars[0].vval.v_number == (isTrue ? VVAL_TRUE : VV_FALSE))
9221+
return;
92199222
if (argvars[0].v_type != VAR_NUMBER
92209223
|| (get_tv_number_chk(&argvars[0], &error) == 0) == isTrue
92219224
|| error)

src/testdir/test_assert.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
func Test_assert_false()
44
call assert_false(0)
5+
call assert_false(v:false)
56
endfunc
67

78
func Test_assert_true()
89
call assert_true(1)
910
call assert_true(123)
11+
call assert_true(v:true)
1012
endfunc
1113

1214
func Test_assert_equal()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
1271,
745747
/**/
746748
1270,
747749
/**/

0 commit comments

Comments
 (0)