Mercurial > vim
annotate src/testdir/test_pyx2.vim @ 18469:66964658cc3c v8.1.2228
patch 8.1.2228: screenpos() returns wrong values when 'number' is set
Commit: https://github.com/vim/vim/commit/38ba4dce4a8574e60f6ddb111922880b0c7affdc
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 27 21:39:09 2019 +0100
patch 8.1.2228: screenpos() returns wrong values when 'number' is set
Problem: screenpos() returns wrong values when 'number' is set. (Ben
Jackson)
Solution: Compare the column with the window width. (closes #5133)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 27 Oct 2019 21:45:03 +0100 |
parents | 6d11a0d5751d |
children | 04ef2ccf2519 |
rev | line source |
---|---|
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for pyx* commands and functions with Python 2. |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 set pyx=2 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
4 source check.vim |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
5 CheckFeature python |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 let s:py2pattern = '^2\.[0-7]\.\d\+' |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 let s:py3pattern = '^3\.\d\+\.\d\+' |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 func Test_has_pythonx() |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call assert_true(has('pythonx')) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 endfunc |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 func Test_pyx() |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 redir => var |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 pyx << EOF |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 import sys |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 print(sys.version) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 EOF |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 redir END |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_match(s:py2pattern, split(var)[0]) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endfunc |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 func Test_pyxdo() |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 pyx import sys |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 enew |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 pyxdo return sys.version.split("\n")[0] |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call assert_match(s:py2pattern, split(getline('.'))[0]) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 endfunc |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 func Test_pyxeval() |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 pyx import sys |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
37 call assert_match(s:py2pattern, split('sys.version'->pyxeval())[0]) |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 endfunc |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 func Test_pyxfile() |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 " No special comments nor shebangs |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 redir => var |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 pyxfile pyxfile/pyx.py |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 redir END |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 call assert_match(s:py2pattern, split(var)[0]) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 " Python 2 special comment |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 redir => var |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 pyxfile pyxfile/py2_magic.py |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 redir END |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 call assert_match(s:py2pattern, split(var)[0]) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 " Python 2 shebang |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 redir => var |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 pyxfile pyxfile/py2_shebang.py |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 redir END |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 call assert_match(s:py2pattern, split(var)[0]) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 if has('python3') |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 " Python 3 special comment |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 redir => var |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 pyxfile pyxfile/py3_magic.py |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 redir END |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 call assert_match(s:py3pattern, split(var)[0]) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 " Python 3 shebang |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 redir => var |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 pyxfile pyxfile/py3_shebang.py |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 redir END |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 call assert_match(s:py3pattern, split(var)[0]) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 endif |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 endfunc |
16688
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
10722
diff
changeset
|
74 |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
10722
diff
changeset
|
75 func Test_Catch_Exception_Message() |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
10722
diff
changeset
|
76 try |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
10722
diff
changeset
|
77 pyx raise RuntimeError( 'TEST' ) |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
10722
diff
changeset
|
78 catch /.*/ |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
10722
diff
changeset
|
79 call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
10722
diff
changeset
|
80 endtry |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
10722
diff
changeset
|
81 endfunc |