annotate src/testdir/test_execute_func.vim @ 26490:cd452f46085e v8.2.3775

patch 8.2.3775: Vim9: lambda compiled without outer context when debugging Commit: https://github.com/vim/vim/commit/9fffef9f3562e05755e4b3c46509b2eeeb623ff7 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 10 16:55:58 2021 +0000 patch 8.2.3775: Vim9: lambda compiled without outer context when debugging Problem: Vim9: lambda compiled without outer context when debugging. Solution: When compiling a lambda for debugging also compile it without. (closes #9302)
author Bram Moolenaar <Bram@vim.org>
date Fri, 10 Dec 2021 18:00:05 +0100
parents 2c64a420ce7e
children a07323eb647f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9454
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " test execute()
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
18259
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
3 source view_util.vim
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18763
diff changeset
4 source check.vim
24822
5f8dd7b3ae41 patch 8.2.2949: tests failing because no error for float to string conversion
Bram Moolenaar <Bram@vim.org>
parents: 23596
diff changeset
5 source vim9.vim
18259
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
6
9454
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func NestedEval()
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 let nested = execute('echo "nested\nlines"')
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 echo 'got: "' . nested . '"'
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endfunc
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 func NestedRedir()
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 redir => var
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 echo 'broken'
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 redir END
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 endfunc
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 func Test_execute_string()
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal("\nnocompatible", execute('set compatible?'))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call assert_equal("\nsomething\nnice", execute('echo "something\nnice"'))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal("noendofline", execute('echon "noendofline"'))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal("", execute(123))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_equal("\ngot: \"\nnested\nlines\"", execute('call NestedEval()'))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 redir => redired
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 echo 'this'
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 let evaled = execute('echo "that"')
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 echo 'theend'
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 redir END
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal("\nthis\ntheend", redired)
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call assert_equal("\nthat", evaled)
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call assert_fails('call execute("doesnotexist")', 'E492:')
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_fails('call execute("call NestedRedir()")', 'E930:')
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal("\nsomething", execute('echo "something"', ''))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal("\nsomething", execute('echo "something"', 'silent'))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal("\nsomething", execute('echo "something"', 'silent!'))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call assert_equal("", execute('burp', 'silent!'))
19249
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 19085
diff changeset
40 if has('float')
24822
5f8dd7b3ae41 patch 8.2.2949: tests failing because no error for float to string conversion
Bram Moolenaar <Bram@vim.org>
parents: 23596
diff changeset
41 call assert_fails('call execute(3.4)', 'E492:')
5f8dd7b3ae41 patch 8.2.2949: tests failing because no error for float to string conversion
Bram Moolenaar <Bram@vim.org>
parents: 23596
diff changeset
42 call assert_equal("\nx", execute("echo \"x\"", 3.4))
25384
e8e2c4d33b9b patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents: 24974
diff changeset
43 call CheckDefExecAndScriptFailure2(['execute("echo \"x\"", 3.4)'], 'E1013: Argument 2: type mismatch, expected string but got float', 'E1174:')
19249
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 19085
diff changeset
44 endif
9454
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 endfunc
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 func Test_execute_list()
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 call assert_equal("\nsomething\nnice", execute(['echo "something"', 'echo "nice"']))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 let l = ['for n in range(0, 3)',
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 \ 'echo n',
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 \ 'endfor']
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 call assert_equal("\n0\n1\n2\n3", execute(l))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 call assert_equal("", execute([]))
9da0cb39cbee commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 endfunc
15117
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
56
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
57 func Test_execute_does_not_change_col()
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
58 echo ''
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
59 echon 'abcd'
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
60 let x = execute('silent echo 234343')
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
61 echon 'xyz'
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
62 let text = ''
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
63 for col in range(1, 7)
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
64 let text .= nr2char(screenchar(&lines, col))
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
65 endfor
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
66 call assert_equal('abcdxyz', text)
2fed75dee954 patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 9454
diff changeset
67 endfunc
15121
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
68
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
69 func Test_execute_not_silent()
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
70 echo ''
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
71 echon 'abcd'
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
72 let x = execute('echon 234', '')
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
73 echo 'xyz'
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
74 let text1 = ''
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
75 for col in range(1, 8)
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
76 let text1 .= nr2char(screenchar(&lines - 1, col))
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
77 endfor
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
78 call assert_equal('abcd234 ', text1)
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
79 let text2 = ''
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
80 for col in range(1, 4)
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
81 let text2 .= nr2char(screenchar(&lines, col))
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
82 endfor
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
83 call assert_equal('xyz ', text2)
895abc8a5195 patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents: 15117
diff changeset
84 endfunc
16833
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
85
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
86 func Test_win_execute()
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
87 let thiswin = win_getid()
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
88 new
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
89 let otherwin = win_getid()
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
90 call setline(1, 'the new window')
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
91 call win_gotoid(thiswin)
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
92 let line = win_execute(otherwin, 'echo getline(1)')
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
93 call assert_match('the new window', line)
23596
9fa72351c18f patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents: 20156
diff changeset
94 let line = win_execute(134343, 'echo getline(1)')
9fa72351c18f patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents: 20156
diff changeset
95 call assert_equal('', line)
16833
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
96
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18259
diff changeset
97 if has('popupwin')
16833
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
98 let popupwin = popup_create('the popup win', {'line': 2, 'col': 3})
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
99 redraw
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17670
diff changeset
100 let line = 'echo getline(1)'->win_execute(popupwin)
16833
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
101 call assert_match('the popup win', line)
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
102
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
103 call popup_close(popupwin)
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
104 endif
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
105
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
106 call win_gotoid(otherwin)
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
107 bwipe!
26121
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
108
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
109 " check :lcd in another window does not change directory
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
110 let curid = win_getid()
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
111 let curdir = getcwd()
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
112 split Xother
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
113 lcd ..
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
114 " Use :pwd to get the actual current directory
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
115 let otherdir = execute('pwd')
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
116 call win_execute(curid, 'lcd testdir')
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
117 call assert_equal(otherdir, execute('pwd'))
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
118 bwipe!
2c64a420ce7e patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents: 25384
diff changeset
119 execute 'cd ' .. curdir
16833
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 15121
diff changeset
120 endfunc
17670
1be29c149103 patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
121
18259
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
122 func Test_win_execute_update_ruler()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18763
diff changeset
123 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18763
diff changeset
124
18259
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
125 enew
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
126 call setline(1, range(500))
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
127 20
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
128 split
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
129 let winid = win_getid()
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
130 set ruler
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
131 wincmd w
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
132 let height = winheight(winid)
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
133 redraw
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
134 call assert_match('20,1', Screenline(height + 1))
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
135 let line = win_execute(winid, 'call cursor(100, 1)')
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
136 redraw
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
137 call assert_match('100,1', Screenline(height + 1))
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
138
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
139 bwipe!
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
140 endfunc
f254dd2bc107 patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
141
17670
1be29c149103 patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
142 func Test_win_execute_other_tab()
1be29c149103 patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
143 let thiswin = win_getid()
1be29c149103 patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
144 tabnew
1be29c149103 patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
145 call win_execute(thiswin, 'let xyz = 1')
1be29c149103 patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
146 call assert_equal(1, xyz)
1be29c149103 patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
147 tabclose
1be29c149103 patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
148 unlet xyz
1be29c149103 patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
149 endfunc
19085
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
150
20156
49694eceaa55 patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
151 func Test_execute_func_with_null()
19085
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
152 call assert_equal("", execute(test_null_string()))
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
153 call assert_equal("", execute(test_null_list()))
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
154 call assert_fails('call execute(test_null_dict())', 'E731:')
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
155 call assert_fails('call execute(test_null_blob())', 'E976:')
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
156 call assert_fails('call execute(test_null_partial())','E729:')
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
157 if has('job')
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
158 call assert_fails('call execute(test_null_job())', 'E908:')
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
159 call assert_fails('call execute(test_null_channel())', 'E908:')
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
160 endif
fd1070ff696b patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
161 endfunc
20156
49694eceaa55 patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
162
49694eceaa55 patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
163 " vim: shiftwidth=2 sts=2 expandtab