Mercurial > vim
annotate src/testdir/test_interrupt.vim @ 33337:19b4f85c2649 v9.0.1932
patch 9.0.1932: Vim9: error when using null object constructor
Commit: https://github.com/vim/vim/commit/7398f367d5125eedfb4058c63a5d167fe8601e3d
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Sep 24 23:09:10 2023 +0200
patch 9.0.1932: Vim9: error when using null object constructor
Problem: Vim9: error when using null object constructor
Solution: Check for a null object only when calling an object method
closes: #13154
closes: #13163
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 24 Sep 2023 23:15:07 +0200 |
parents | 860f148e7a64 |
children |
rev | line source |
---|---|
18699
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Test behavior of interrupt() |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 let s:bufwritepre_called = 0 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 let s:bufwritepost_called = 0 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 func s:bufwritepre() |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 let s:bufwritepre_called = 1 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 call interrupt() |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 endfunction |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 func s:bufwritepost() |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 let s:bufwritepost_called = 1 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 endfunction |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 func Test_interrupt() |
29204
860f148e7a64
patch 8.2.5121: interrupt test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
16 new Xinterrupt |
18699
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 let n = 0 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 try |
29204
860f148e7a64
patch 8.2.5121: interrupt test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
19 au BufWritePre Xinterrupt call s:bufwritepre() |
860f148e7a64
patch 8.2.5121: interrupt test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
20 au BufWritePost Xinterrupt call s:bufwritepost() |
18699
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 w! |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 catch /^Vim:Interrupt$/ |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 endtry |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 call assert_equal(1, s:bufwritepre_called) |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 call assert_equal(0, s:bufwritepost_called) |
29204
860f148e7a64
patch 8.2.5121: interrupt test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
26 call assert_equal(0, filereadable('Xinterrupt')) |
860f148e7a64
patch 8.2.5121: interrupt test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
27 |
860f148e7a64
patch 8.2.5121: interrupt test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
28 au! BufWritePre |
860f148e7a64
patch 8.2.5121: interrupt test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
29 au! BufWritePost |
18699
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
31 |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
32 " vim: shiftwidth=2 sts=2 expandtab |