diff options
| author | Bram Moolenaar <Bram@vim.org> | 2020-06-03 19:55:35 +0200 | 
|---|---|---|
| committer | Bram Moolenaar <Bram@vim.org> | 2020-06-03 19:55:35 +0200 | 
| commit | fb517bac2384798bb5142ed1f75f965f93984c0a (patch) | |
| tree | 44d7bd1442dfa1af46844cbe84a099bd87eb2007 /src | |
| parent | c5acc0f7fed6b061d994fc5ac660dcc0312750bd (diff) | |
| download | vim-git-fb517bac2384798bb5142ed1f75f965f93984c0a.tar.gz | |
patch 8.2.0893: assert_equalfile() does not take a third argumentv8.2.0893
Problem:    Assert_equalfile() does not take a third argument.
Solution:   Implement the third argument. (Gary Johnson)
Diffstat (limited to 'src')
| -rw-r--r-- | src/evalfunc.c | 2 | ||||
| -rw-r--r-- | src/testdir/test_assert.vim | 4 | ||||
| -rw-r--r-- | src/testing.c | 11 | ||||
| -rw-r--r-- | src/version.c | 2 | 
4 files changed, 17 insertions, 2 deletions
| diff --git a/src/evalfunc.c b/src/evalfunc.c index d8e88e5c6..247d2ea20 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -419,7 +419,7 @@ static funcentry_T global_functions[] =      {"asin",		1, 1, FEARG_1,	  ret_float,	FLOAT_FUNC(f_asin)},      {"assert_beeps",	1, 2, FEARG_1,	  ret_number,	f_assert_beeps},      {"assert_equal",	2, 3, FEARG_2,	  ret_number,	f_assert_equal}, -    {"assert_equalfile", 2, 2, FEARG_1,	  ret_number,	f_assert_equalfile}, +    {"assert_equalfile", 2, 3, FEARG_1,	  ret_number,	f_assert_equalfile},      {"assert_exception", 1, 2, 0,	  ret_number,	f_assert_exception},      {"assert_fails",	1, 3, FEARG_1,	  ret_number,	f_assert_fails},      {"assert_false",	1, 2, FEARG_1,	  ret_number,	f_assert_false}, diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim index 762f12ff5..5037d87b8 100644 --- a/src/testdir/test_assert.vim +++ b/src/testdir/test_assert.vim @@ -81,6 +81,10 @@ func Test_assert_equalfile()    call assert_match("difference at byte 4", v:errors[0])    call remove(v:errors, 0) +  call assert_equal(1, assert_equalfile('Xone', 'Xtwo', 'a message')) +  call assert_match("a message: difference at byte 4", v:errors[0]) +  call remove(v:errors, 0) +    call delete('Xone')    call delete('Xtwo')  endfunc diff --git a/src/testing.c b/src/testing.c index 604d39b74..fa8cc4241 100644 --- a/src/testing.c +++ b/src/testing.c @@ -362,6 +362,15 @@ assert_equalfile(typval_T *argvars)      if (IObuff[0] != NUL)      {  	prepare_assert_error(&ga); +	if (argvars[2].v_type != VAR_UNKNOWN) +	{ +	    char_u	numbuf[NUMBUFLEN]; +	    char_u	*tofree; + +	    ga_concat(&ga, echo_string(&argvars[2], &tofree, numbuf, 0)); +	    vim_free(tofree); +	    ga_concat(&ga, (char_u *)": "); +	}  	ga_concat(&ga, IObuff);  	assert_error(&ga);  	ga_clear(&ga); @@ -371,7 +380,7 @@ assert_equalfile(typval_T *argvars)  }  /* - * "assert_equalfile(fname-one, fname-two)" function + * "assert_equalfile(fname-one, fname-two[, msg])" function   */      void  f_assert_equalfile(typval_T *argvars, typval_T *rettv) diff --git a/src/version.c b/src/version.c index a241fa0a2..fc6d897ba 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) =  static int included_patches[] =  {   /* Add new patch number below this line */  /**/ +    893, +/**/      892,  /**/      891, | 
