summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0460
blob: 15d5d86170f0e8a4d98997bbd8b80e707bb4e86b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0460
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0460
Problem:    assert_fails() does not take a message argument
Solution:   Add the argument.
Files:	    src/evalfunc.c, src/eval.c, src/testdir/test_assert.vim


*** ../vim-8.1.0459/src/evalfunc.c	2018-10-02 16:23:55.323037143 +0200
--- src/evalfunc.c	2018-10-07 19:19:21.730142635 +0200
***************
*** 512,518 ****
      {"assert_equal",	2, 3, f_assert_equal},
      {"assert_equalfile", 2, 2, f_assert_equalfile},
      {"assert_exception", 1, 2, f_assert_exception},
!     {"assert_fails",	1, 2, f_assert_fails},
      {"assert_false",	1, 2, f_assert_false},
      {"assert_inrange",	3, 4, f_assert_inrange},
      {"assert_match",	2, 3, f_assert_match},
--- 512,518 ----
      {"assert_equal",	2, 3, f_assert_equal},
      {"assert_equalfile", 2, 2, f_assert_equalfile},
      {"assert_exception", 1, 2, f_assert_exception},
!     {"assert_fails",	1, 3, f_assert_fails},
      {"assert_false",	1, 2, f_assert_false},
      {"assert_inrange",	3, 4, f_assert_inrange},
      {"assert_match",	2, 3, f_assert_match},
***************
*** 1507,1513 ****
  }
  
  /*
!  * "assert_fails(cmd [, error])" function
   */
      static void
  f_assert_fails(typval_T *argvars, typval_T *rettv)
--- 1507,1513 ----
  }
  
  /*
!  * "assert_fails(cmd [, error[, msg]])" function
   */
      static void
  f_assert_fails(typval_T *argvars, typval_T *rettv)
*** ../vim-8.1.0459/src/eval.c	2018-09-30 21:43:17.179693404 +0200
--- src/eval.c	2018-10-07 19:41:59.353098530 +0200
***************
*** 9041,9046 ****
--- 9041,9048 ----
      char_u	*cmd = get_tv_string_chk(&argvars[0]);
      garray_T	ga;
      int		ret = 0;
+     char_u	numbuf[NUMBUFLEN];
+     char_u	*tofree;
  
      called_emsg = FALSE;
      suppress_errthrow = TRUE;
***************
*** 9050,9056 ****
      {
  	prepare_assert_error(&ga);
  	ga_concat(&ga, (char_u *)"command did not fail: ");
! 	ga_concat(&ga, cmd);
  	assert_error(&ga);
  	ga_clear(&ga);
  	ret = 1;
--- 9052,9065 ----
      {
  	prepare_assert_error(&ga);
  	ga_concat(&ga, (char_u *)"command did not fail: ");
! 	if (argvars[1].v_type != VAR_UNKNOWN
! 					   && argvars[2].v_type != VAR_UNKNOWN)
! 	{
! 	    ga_concat(&ga, echo_string(&argvars[2], &tofree, numbuf, 0));
! 	    vim_free(tofree);
! 	}
! 	else
! 	    ga_concat(&ga, cmd);
  	assert_error(&ga);
  	ga_clear(&ga);
  	ret = 1;
*** ../vim-8.1.0459/src/testdir/test_assert.vim	2018-06-12 14:58:35.566840630 +0200
--- src/testdir/test_assert.vim	2018-10-07 20:13:06.084010801 +0200
***************
*** 152,157 ****
--- 152,165 ----
    call assert_equal(1, assert_fails('xxx', {}))
    call assert_match("Expected {} but got 'E731:", v:errors[0])
    call remove(v:errors, 0)
+ 
+   call assert_equal(1, assert_fails('xxx', {}, 'stupid'))
+   call assert_match("stupid: Expected {} but got 'E731:", v:errors[0])
+   call remove(v:errors, 0)
+ 
+   call assert_equal(1, assert_fails('echo', '', 'echo command'))
+   call assert_match("command did not fail: echo command", v:errors[0])
+   call remove(v:errors, 0)
  endfunc
  
  func Test_assert_beeps()
*** ../vim-8.1.0459/src/version.c	2018-10-07 18:43:02.528682005 +0200
--- src/version.c	2018-10-07 20:06:14.534617784 +0200
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     460,
  /**/

-- 
Did you ever see a "Hit any key to continue" message in a music piece?

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///