Skip to content

Commit 065ee9a

Browse files
committed
patch 7.4.1097
Problem: Looking up the alloc ID for tests fails. Solution: Fix the line computation. Use assert_fails() for unlet test.
1 parent a260b87 commit 065ee9a

3 files changed

Lines changed: 11 additions & 20 deletions

File tree

src/testdir/runtest.vim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@ let s:srcdir = expand('%:p:h:h')
4848
" Support function: get the alloc ID by name.
4949
function GetAllocId(name)
5050
exe 'split ' . s:srcdir . '/alloc.h'
51-
/typedef enum/
52-
let top = getline('.')
51+
let top = search('typedef enum')
52+
if top == 0
53+
call add(v:errors, 'typedef not found in alloc.h')
54+
endif
5355
let lnum = search('aid_' . a:name . ',')
5456
if lnum == 0
5557
call add(v:errors, 'Alloc ID ' . a:name . ' not defined')
5658
endif
5759
close
58-
return lnum - top
60+
return lnum - top - 1
5961
endfunc
6062

6163

src/testdir/test_unlet.vim

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
" Tests for :unlet
22

33
func Test_read_only()
4-
try
5-
" this caused a crash
6-
unlet count
7-
catch
8-
call assert_true(v:exception =~ ':E795:')
9-
endtry
10-
try
11-
" this caused a crash
12-
unlet errmsg
13-
catch
14-
call assert_true(v:exception =~ ':E795:')
15-
endtry
4+
" these caused a crash
5+
call assert_fails('unlet count', 'E795:')
6+
call assert_fails('unlet errmsg', 'E795:')
167
endfunc
178

189
func Test_existing()
@@ -24,9 +15,5 @@ endfunc
2415

2516
func Test_not_existing()
2617
unlet! does_not_exist
27-
try
28-
unlet does_not_exist
29-
catch
30-
call assert_true(v:exception =~ ':E108:')
31-
endtry
18+
call assert_fails('unlet does_not_exist', 'E108:')
3219
endfunc

src/version.c

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

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
1097,
744746
/**/
745747
1096,
746748
/**/

0 commit comments

Comments
 (0)