blob: e2ce0e02cd2ef757463cf8b64eb62f75d1366d62 (
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
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1311
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.1311
Problem: Aborting an autocmd with an exception is not tested.
Solution: Add a test. Also shows how to abort a command by throwing an
exception.
Files: src/testdir/test_autocmd.vim
*** ../vim-8.1.1310/src/testdir/test_autocmd.vim 2019-04-25 22:21:56.931749183 +0200
--- src/testdir/test_autocmd.vim 2019-05-09 21:33:57.024924448 +0200
***************
*** 1733,1735 ****
--- 1733,1754 ----
call delete('Xtest.c')
call delete('test.out')
endfunc
+
+ func Test_throw_in_BufWritePre()
+ new
+ call setline(1, ['one', 'two', 'three'])
+ call assert_false(filereadable('Xthefile'))
+ augroup throwing
+ au BufWritePre X* throw 'do not write'
+ augroup END
+ try
+ w Xthefile
+ catch
+ let caught = 1
+ endtry
+ call assert_equal(1, caught)
+ call assert_false(filereadable('Xthefile'))
+
+ bwipe!
+ au! throwing
+ endfunc
*** ../vim-8.1.1310/src/version.c 2019-05-09 21:08:53.764083394 +0200
--- src/version.c 2019-05-09 21:37:32.256160734 +0200
***************
*** 769,770 ****
--- 769,772 ----
{ /* Add new patch number below this line */
+ /**/
+ 1311,
/**/
--
Corn oil comes from corn and olive oil comes from olives, so where
does baby oil come from?
/// 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 ///
|