annotate src/testdir/test_interrupt.vim @ 20627:8bce783af0cb v8.2.0867

patch 8.2.0867: using {xxx} for encoding a modifier is not nice Commit: https://github.com/vim/vim/commit/fccd93f0917234b962ce07d1df3adf9d7105936f Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 31 22:06:51 2020 +0200 patch 8.2.0867: using \{xxx} for encoding a modifier is not nice Problem: Using \{xxx} for encoding a modifier is not nice. Solution: Use \<*xxx> instead, since it's the same as \<xxx> but producing a different code.
author Bram Moolenaar <Bram@vim.org>
date Sun, 31 May 2020 22:15:03 +0200
parents 1febd1aa9930
children 08940efa6b4e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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()
1febd1aa9930 patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 new Xfile
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
1febd1aa9930 patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 au BufWritePre Xfile call s:bufwritepre()
1febd1aa9930 patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 au BufWritePost Xfile call s:bufwritepost()
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)
1febd1aa9930 patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 call assert_equal(0, filereadable('Xfile'))
1febd1aa9930 patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 endfunc