Mercurial > vim
annotate src/testdir/test_vimscript.vim @ 21632:792398a9fe39 v8.2.1366
patch 8.2.1366: test 49 is old style
Commit: https://github.com/vim/vim/commit/a6296200bd5191bab7efcdcc16c9e79eb498e8e0
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 5 11:23:13 2020 +0200
patch 8.2.1366: test 49 is old style
Problem: Test 49 is old style.
Solution: Convert several tests to new style. (Yegappan Lakshmanan,
closes #6629)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 05 Aug 2020 11:30:03 +0200 |
parents | 8fb0e507491d |
children | 97b887aecd4a |
rev | line source |
---|---|
13351
33a2277b8d4d
patch 8.0.1549: various small problems in test files
Christian Brabandt <cb@256bit.org>
parents:
12523
diff
changeset
|
1 " Test various aspects of the Vim script language. |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " Most of this was formerly in test49. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17251
diff
changeset
|
4 source check.vim |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
5 source shared.vim |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
6 source script_util.vim |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17251
diff
changeset
|
7 |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " Test environment {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 " Append a message to the "messages" file |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
13 func Xout(text) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 split messages |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 $put =a:text |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 wq |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 com! -nargs=1 Xout call Xout(<args>) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
21 " Create a new instance of Vim and run the commands in 'test' and then 'verify' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
22 " The commands in 'test' are expected to store the test results in the Xtest.out |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
23 " file. If the test passes successfully, then Xtest.out should be empty. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
24 func RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
25 let init =<< trim END |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
26 source script_util.vim |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
27 XpathINIT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
28 XloopINIT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
29 END |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
30 let cleanup =<< trim END |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
31 call writefile(v:errors, 'Xtest.out') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
32 qall |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
33 END |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
34 call writefile(init, 'Xtest.vim') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
35 call writefile(a:test, 'Xtest.vim', 'a') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
36 call writefile(a:verify, 'Xverify.vim') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
37 call writefile(cleanup, 'Xverify.vim', 'a') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
38 call RunVim([], [], "-S Xtest.vim -S Xverify.vim") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
39 call assert_equal([], readfile('Xtest.out')) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
40 call delete('Xtest.out') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
41 call delete('Xtest.vim') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
42 call delete('Xverify.vim') |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
43 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 " Test 1: :endwhile in function {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 " Detect if a broken loop is (incorrectly) reactivated by the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 " :endwhile. Use a :return to prevent an endless loop, and make |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 " this test first to get a meaningful result on an error before other |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 " tests will hang. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
54 func T1_F() |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 let first = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 if first |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 let first = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 endwhile |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
68 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
69 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
70 func T1_G() |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 let first = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 if first |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 let first = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 if 1 " unmatched :if |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 endwhile |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
85 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 func Test_endwhile_function() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 call T1_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 Xpath 'F' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 try |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 call T1_G() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 catch |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 " Catch missing :endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 call assert_true(v:exception =~ 'E171') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 Xpath 'G' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 call assert_equal('abcFhijxG', g:Xpath) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 " Test 2: :endwhile in script {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 " Detect if a broken loop is (incorrectly) reactivated by the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 " :endwhile. Use a :finish to prevent an endless loop, and place |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 " this test before others that might hang to get a meaningful result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 " on an error. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 " This test executes the bodies of the functions T1_F and T1_G from |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 " the previous test as script files (:return replaced by :finish). |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 func Test_endwhile_script() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 ExecAsScript T1_F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 Xpath 'F' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 call DeleteTheScript() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 try |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 ExecAsScript T1_G |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 catch |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 " Catch missing :endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 call assert_true(v:exception =~ 'E171') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 Xpath 'G' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 call DeleteTheScript() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 call assert_equal('abcFhijxG', g:Xpath) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 " Test 3: :if, :elseif, :while, :continue, :break {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
139 func Test_if_while() |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 let loops = 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 while loops > -1 " main loop: loops == 3, 2, 1 (which breaks) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 if loops <= 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 let break_err = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 let loops = -1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 Xpath 'b' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 if (loops == 2) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 while loops == 2 " dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 Xpath 'c' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 let loops = loops - 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 continue " stop dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 Xpath 'd' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 continue " continue main loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 Xpath 'e' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 elseif (loops == 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 let p = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 while p " dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 Xpath 'f' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 let p = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 break " break dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 Xpath 'g' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 Xpath 'h' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 unlet p |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 break " break main loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 Xpath 'i' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 if (loops > 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 Xpath 'j' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 while loops == 3 " dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 let loops = loops - 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 endwhile " end dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 endwhile " end main loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 if exists("break_err") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 unlet break_err |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 unlet loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 " Test 4: :return {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
199 func T4_F() |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 let loops = 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 while loops > 0 " 3: 2: 1: |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 Xpath 'b' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 if (loops == 2) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 Xpath 'c' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 Xpath 'd' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 Xpath 'e' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 let loops = loops - 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 endif |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
217 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
218 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
219 func Test_return() |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 call T4_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 Xpath '4' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 call assert_equal('ab3e3b2c24', g:Xpath) |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
225 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 " Test 5: :finish {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 " This test executes the body of the function T4_F from the previous |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 " test as a script file (:return replaced by :finish). |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
235 func Test_finish() |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 ExecAsScript T4_F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 Xpath '5' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 call DeleteTheScript() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 call assert_equal('ab3e3b2c25', g:Xpath) |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
242 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
246 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 " Test 6: Defining functions in :while loops {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
249 " Functions can be defined inside other functions. An inner function |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
250 " gets defined when the outer function is executed. Functions may |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
251 " also be defined inside while loops. Expressions in braces for |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 " defining the function name are allowed. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 " The functions are defined when sourcing the script, only the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 " resulting path is checked in the test function. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
256 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
259 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 " The command CALL collects the argument of all its invocations in "calls" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 " when used from a function (that is, when the global variable "calls" needs |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
262 " the "g:" prefix). This is to check that the function code is skipped when |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
263 " the function is defined. For inner functions, do so only if the outer |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
264 " function is not being executed. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
265 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
266 let calls = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
267 com! -nargs=1 CALL |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
268 \ if !exists("calls") && !exists("outer") | |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
269 \ let g:calls = g:calls . <args> | |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
270 \ endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
271 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
272 let i = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
273 while i < 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
274 let i = i + 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
275 if i == 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
276 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
277 function! F1(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
278 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
279 let outer = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
280 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
281 let j = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
282 while j < 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
283 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
284 let j = j + 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
285 function! G1(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
286 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
287 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
288 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
289 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
290 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
291 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
292 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
293 continue |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
294 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
295 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
296 Xpath 'e' . i |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
297 function! F{i}(i, arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
298 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
299 let outer = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
300 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
301 if a:i == 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
302 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
303 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
304 let k = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
305 while k < 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
306 Xpath 'g' . k |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
307 let k = k + 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
308 function! G{a:i}{k}(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
309 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
310 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
311 Xpath 'h' . k |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
312 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
313 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
314 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
315 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
316 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
317 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 if exists("*G1") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
319 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
320 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 if exists("*F1") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
322 call F1("F1") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
323 if exists("*G1") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
324 call G1("G1") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
325 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
326 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
327 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 if exists("G21") || exists("G22") || exists("G23") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
329 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
330 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
331 if exists("*F2") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
332 call F2(2, "F2") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 if exists("*G21") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
334 call G21("G21") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
336 if exists("*G22") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
337 call G22("G22") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
338 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 if exists("*G23") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
340 call G23("G23") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
342 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
343 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
344 if exists("G31") || exists("G32") || exists("G33") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
347 if exists("*F3") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
348 call F3(3, "F3") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
349 if exists("*G31") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
350 call G31("G31") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 if exists("*G32") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
353 call G32("G32") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 if exists("*G33") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
356 call G33("G33") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
357 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
358 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
359 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
360 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
362 let g:test6_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
363 let g:test6_calls = calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
364 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 unlet calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
366 delfunction F1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 delfunction G1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
368 delfunction F2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 delfunction G21 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
370 delfunction G22 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
371 delfunction G23 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
372 delfunction G31 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
373 delfunction G32 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
374 delfunction G33 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
375 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
376 func Test_defining_functions() |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
377 call assert_equal('ade2ie3ibcg0h1g1h2g2h3fg0h1g1h2g2h3m', g:test6_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
378 call assert_equal('F1G1F2G21G22G23F3G31G32G33', g:test6_calls) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
379 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
380 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
381 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
382 " Test 7: Continuing on errors outside functions {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
383 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
384 " On an error outside a function, the script processing continues |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 " at the line following the outermost :endif or :endwhile. When not |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
386 " inside an :if or :while, the script processing continues at the next |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
387 " line. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
388 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
389 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
390 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
391 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
392 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
393 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
394 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
395 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
396 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
397 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
398 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
399 endwhile | Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
400 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
401 endif | Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
402 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
403 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
404 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
405 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
406 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
407 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
408 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
409 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
410 endif | Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
411 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
412 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
413 endwhile | Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
414 Xpath 'n' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
415 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
416 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
417 Xpath 'o' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
418 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
419 asdf | Xpath 'p' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
420 Xpath 'q' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
421 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
422 let g:test7_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
423 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
424 func Test_error_in_script() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
425 call assert_equal('abghinoq', g:test7_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
426 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
427 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
428 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
429 " Test 8: Aborting and continuing on errors inside functions {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
430 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
431 " On an error inside a function without the "abort" attribute, the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
432 " script processing continues at the next line (unless the error was |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
433 " in a :return command). On an error inside a function with the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
434 " "abort" attribute, the function is aborted and the script processing |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
435 " continues after the function call; the value -1 is returned then. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
436 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
437 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
438 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
439 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
440 func T8_F() |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
441 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
442 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
443 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
444 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
445 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
446 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
447 asdf | Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
448 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
449 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
450 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
451 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
452 endif | Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
453 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
454 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
455 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
456 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
457 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
458 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
459 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
460 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
461 asdf | Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
462 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
463 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
464 Xpath 'n' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
465 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
466 endwhile | Xpath 'o' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
467 Xpath 'p' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
468 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
469 return novar " returns (default return value 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
470 Xpath 'q' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
471 return 1 " not reached |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
472 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
473 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
474 func T8_G() abort |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
475 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
476 Xpath 'r' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
477 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
478 Xpath 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
479 asdf " returns -1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
480 Xpath 't' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
481 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
482 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
483 Xpath 'v' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
484 endif | Xpath 'w' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
485 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
486 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
487 return -4 " not reached |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
488 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
489 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
490 func T8_H() abort |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
491 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
492 Xpath 'A' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
493 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
494 Xpath 'B' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
495 asdf " returns -1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
496 Xpath 'C' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
497 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
498 Xpath 'D' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
499 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
500 endwhile | Xpath 'E' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
501 Xpath 'F' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
502 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
503 return -4 " not reached |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
504 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
505 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
506 " Aborted functions (T8_G and T8_H) return -1. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
507 let g:test8_sum = (T8_F() + 1) - 4 * T8_G() - 8 * T8_H() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
508 Xpath 'X' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
509 let g:test8_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
510 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
511 func Test_error_in_function() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
512 call assert_equal(13, g:test8_sum) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
513 call assert_equal('abcefghijkmnoprsABX', g:test8_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
514 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
515 delfunction T8_F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
516 delfunction T8_G |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
517 delfunction T8_H |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
518 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
519 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
520 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
521 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
522 " Test 9: Continuing after aborted functions {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
523 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
524 " When a function with the "abort" attribute is aborted due to an |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
525 " error, the next function back in the call hierarchy without an |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
526 " "abort" attribute continues; the value -1 is returned then. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
527 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
528 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
529 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
530 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
531 func F() abort |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
532 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
533 let result = G() " not aborted |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
534 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
535 if result != 2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
536 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
537 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
538 return 1 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
539 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
540 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
541 func G() " no abort attribute |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
542 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
543 if H() != -1 " aborted |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
544 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
545 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
546 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
547 return 2 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
548 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
549 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
550 func H() abort |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
551 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
552 call I() " aborted |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
553 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
554 return 4 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
555 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
556 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
557 func I() abort |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
558 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
559 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
560 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
561 return 8 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
562 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
563 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
564 if F() != 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
565 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
566 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
567 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
568 let g:test9_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
569 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
570 delfunction F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
571 delfunction G |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
572 delfunction H |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
573 delfunction I |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
574 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
575 func Test_func_abort() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
576 call assert_equal('adgifb', g:test9_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
577 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
578 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
579 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
580 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
581 " Test 10: :if, :elseif, :while argument parsing {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
582 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
583 " A '"' or '|' in an argument expression must not be mixed up with |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
584 " a comment or a next command after a bar. Parsing errors should |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
585 " be recognized. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
586 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
587 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
588 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
589 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
590 func MSG(enr, emsg) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
591 let english = v:lang == "C" || v:lang =~ '^[Ee]n' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
592 if a:enr == "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
593 Xout "TODO: Add message number for:" a:emsg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
594 let v:errmsg = ":" . v:errmsg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
595 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
596 let match = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
597 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
598 let match = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
599 if v:errmsg == "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
600 Xout "Message missing." |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
601 else |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17783
diff
changeset
|
602 let v:errmsg = v:errmsg->escape('"') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
603 Xout "Unexpected message:" v:errmsg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
604 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
605 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
606 return match |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
607 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
608 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
609 if 1 || strlen("\"") | Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
610 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
611 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
612 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
613 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
614 if 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
615 elseif 1 || strlen("\"") | Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
616 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
617 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
618 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
619 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
620 while 1 || strlen("\"") | Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
621 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
622 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
623 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
624 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
625 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
626 let v:errmsg = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
627 if 1 ||| strlen("\"") | Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
628 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
629 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
630 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
631 if !MSG('E15', "Invalid expression") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
632 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
633 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
634 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
635 let v:errmsg = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
636 if 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
637 elseif 1 ||| strlen("\"") | Xpath 'n' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
638 Xpath 'o' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
639 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
640 Xpath 'p' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
641 if !MSG('E15', "Invalid expression") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
642 Xpath 'q' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
643 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
644 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
645 let v:errmsg = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
646 while 1 ||| strlen("\"") | Xpath 'r' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
647 Xpath 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
648 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
649 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
650 Xpath 't' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
651 if !MSG('E15', "Invalid expression") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
652 Xpath 'u' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
653 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
654 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
655 let g:test10_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
656 delfunction MSG |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
657 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
658 func Test_expr_parsing() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
659 call assert_equal('abcdefghilpt', g:test10_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
660 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
661 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
662 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
663 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
664 " Test 11: :if, :elseif, :while argument evaluation after abort {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
665 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
666 " When code is skipped over due to an error, the boolean argument to |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
667 " an :if, :elseif, or :while must not be evaluated. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
668 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
669 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
670 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
671 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
672 let calls = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
673 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
674 func P(num) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
675 let g:calls = g:calls + a:num " side effect on call |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
676 return 0 |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
677 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
678 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
679 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
680 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
681 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
682 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
683 if P(1) " should not be called |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
684 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
685 elseif !P(2) " should not be called |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
686 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
687 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
688 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
689 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
690 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
691 while P(4) " should not be called |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
692 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
693 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
694 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
695 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
696 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
697 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
698 let g:test11_calls = calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
699 let g:test11_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
700 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
701 unlet calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
702 delfunction P |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
703 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
704 func Test_arg_abort() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
705 call assert_equal(0, g:test11_calls) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
706 call assert_equal('ax', g:test11_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
707 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
708 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
709 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
710 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
711 " Test 12: Expressions in braces in skipped code {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
712 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
713 " In code skipped over due to an error or inactive conditional, |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
714 " an expression in braces as part of a variable or function name |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
715 " should not be evaluated. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
716 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
717 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
718 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
719 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
720 function! NULL() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
721 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
722 return 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
723 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
724 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
725 function! ZERO() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
726 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
727 return 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
728 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
729 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
730 function! F0() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
731 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
732 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
733 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
734 function! F1(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
735 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
736 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
737 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
738 let V0 = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
739 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
740 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
741 echo 0 ? F{NULL() + V{ZERO()}}() : 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
742 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
743 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
744 if 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
745 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
746 call F{NULL() + V{ZERO()}}() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
747 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
748 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
749 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
750 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
751 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
752 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
753 call F1(F{NULL() + V{ZERO()}}()) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
754 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
755 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
756 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
757 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
758 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
759 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
760 call F{NULL() + V{ZERO()}}() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
761 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
762 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
763 let g:test12_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
764 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
765 func Test_braces_skipped() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
766 call assert_equal('fgik', g:test12_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
767 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
768 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
769 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
770 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
771 " Test 13: Failure in argument evaluation for :while {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
772 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
773 " A failure in the expression evaluation for the condition of a :while |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
774 " causes the whole :while loop until the matching :endwhile being |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
775 " ignored. Continuation is at the next following line. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
776 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
777 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
778 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
779 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
780 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
781 while asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
782 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
783 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
784 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
785 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
786 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
787 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
788 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
789 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
790 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
791 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
792 while asdf | Xpath 'f' | endwhile | Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
793 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
794 let g:test13_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
795 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
796 func Test_while_fail() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
797 call assert_equal('aeh', g:test13_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
798 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
799 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
800 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
801 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
802 " Test 14: Failure in argument evaluation for :if {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
803 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
804 " A failure in the expression evaluation for the condition of an :if |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
805 " does not cause the corresponding :else or :endif being matched to |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
806 " a previous :if/:elseif. Neither of both branches of the failed :if |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
807 " are executed. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
808 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
809 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
810 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
811 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
812 function! F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
813 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
814 let x = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
815 if x " false |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
816 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
817 elseif !x " always true |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
818 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
819 let x = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
820 if g:boolvar " possibly undefined |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
821 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
822 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
823 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
824 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
825 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
826 elseif x " never executed |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
827 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
828 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
829 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
830 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
831 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
832 let boolvar = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
833 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
834 Xpath '-' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
835 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
836 unlet boolvar |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
837 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
838 let g:test14_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
839 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
840 delfunction F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
841 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
842 func Test_if_fail() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
843 call assert_equal('acdfh-acfh', g:test14_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
844 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
845 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
846 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
847 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
848 " Test 15: Failure in argument evaluation for :if (bar) {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
849 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
850 " Like previous test, except that the failing :if ... | ... | :endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
851 " is in a single line. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
852 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
853 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
854 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
855 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
856 function! F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
857 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
858 let x = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
859 if x " false |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
860 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
861 elseif !x " always true |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
862 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
863 let x = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
864 if g:boolvar | Xpath 'd' | else | Xpath 'e' | endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
865 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
866 elseif x " never executed |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
867 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
868 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
869 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
870 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
871 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
872 let boolvar = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
873 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
874 Xpath '-' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
875 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
876 unlet boolvar |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
877 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
878 let g:test15_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
879 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
880 delfunction F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
881 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
882 func Test_if_bar_fail() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
883 call assert_equal('acdfh-acfh', g:test15_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
884 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
885 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
886 "------------------------------------------------------------------------------- |
18504
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
887 " Test 16: Double :else or :elseif after :else {{{1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
888 " |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
889 " Multiple :elses or an :elseif after an :else are forbidden. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
890 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
891 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
892 func T16_F() abort |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
893 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
894 Xpath 'a' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
895 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
896 Xpath 'b' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
897 else " aborts function |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
898 Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
899 endif |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
900 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
901 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
902 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
903 func T16_G() abort |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
904 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
905 Xpath 'a' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
906 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
907 Xpath 'b' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
908 elseif 1 " aborts function |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
909 Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
910 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
911 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
912 endif |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
913 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
914 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
915 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
916 func T16_H() abort |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
917 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
918 Xpath 'a' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
919 elseif 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
920 Xpath 'b' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
921 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
922 Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
923 else " aborts function |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
924 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
925 endif |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
926 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
927 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
928 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
929 func T16_I() abort |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
930 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
931 Xpath 'a' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
932 elseif 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
933 Xpath 'b' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
934 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
935 Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
936 elseif 1 " aborts function |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
937 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
938 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
939 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
940 endif |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
941 Xpath 'f' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
942 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
943 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
944 func Test_Multi_Else() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
945 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
946 try |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
947 call T16_F() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
948 catch /E583:/ |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
949 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
950 endtry |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
951 call assert_equal('be', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
952 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
953 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
954 try |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
955 call T16_G() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
956 catch /E584:/ |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
957 Xpath 'f' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
958 endtry |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
959 call assert_equal('bf', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
960 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
961 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
962 try |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
963 call T16_H() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
964 catch /E583:/ |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
965 Xpath 'f' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
966 endtry |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
967 call assert_equal('cf', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
968 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
969 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
970 try |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
971 call T16_I() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
972 catch /E584:/ |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
973 Xpath 'g' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
974 endtry |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
975 call assert_equal('cg', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
976 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
977 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
978 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
979 " Test 17: Nesting of unmatched :if or :endif inside a :while {{{1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
980 " |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
981 " The :while/:endwhile takes precedence in nesting over an unclosed |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
982 " :if or an unopened :endif. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
983 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
984 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
985 " While loops inside a function are continued on error. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
986 func T17_F() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
987 let loops = 3 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
988 while loops > 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
989 let loops -= 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
990 Xpath 'a' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
991 if (loops == 1) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
992 Xpath 'b' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
993 continue |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
994 elseif (loops == 0) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
995 Xpath 'c' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
996 break |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
997 elseif 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
998 Xpath 'd' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
999 " endif missing! |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1000 endwhile " :endwhile after :if 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1001 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1002 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1003 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1004 func T17_G() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1005 let loops = 2 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1006 while loops > 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1007 let loops -= 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1008 Xpath 'a' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1009 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1010 Xpath 'b' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1011 " endif missing |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1012 endwhile " :endwhile after :if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1013 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1014 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1015 func T17_H() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1016 let loops = 2 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1017 while loops > 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1018 let loops -= 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1019 Xpath 'a' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1020 " if missing! |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1021 endif " :endif without :if in while |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1022 Xpath 'b' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1023 endwhile |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1024 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1025 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1026 " Error continuation outside a function is at the outermost :endwhile or :endif. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1027 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1028 let v:errmsg = '' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1029 let loops = 2 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1030 while loops > 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1031 let loops -= 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1032 Xpath 'a' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1033 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1034 Xpath 'b' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1035 " endif missing! Following :endwhile fails. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1036 endwhile | Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1037 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1038 call assert_match('E171:', v:errmsg) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1039 call assert_equal('a1d', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1040 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1041 func Test_unmatched_if_in_while() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1042 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1043 call assert_fails('call T17_F()', 'E171:') |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1044 call assert_equal('a2d2a1b1a0c0e', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1045 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1046 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1047 call assert_fails('call T17_G()', 'E171:') |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1048 call assert_equal('a1a0', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1049 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1050 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1051 call assert_fails('call T17_H()', 'E580:') |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1052 call assert_equal('a1b1a0b0', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1053 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1054 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1055 "------------------------------------------------------------------------------- |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1056 " Test 18: Interrupt (Ctrl-C pressed) {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1057 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1058 " On an interrupt, the script processing is terminated immediately. |
18504
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1059 "------------------------------------------------------------------------------- |
21632
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1060 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1061 func Test_interrupt_while_if() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1062 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1063 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1064 if 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1065 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1066 while 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1067 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1068 if 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1069 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1070 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1071 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1072 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1073 finish |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1074 endif | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1075 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1076 endwhile | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1077 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1078 endif | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1079 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1080 catch /^Vim:Interrupt$/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1081 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1082 endtry | Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1083 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1084 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1085 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1086 call assert_equal('abcdef', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1087 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1088 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1089 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1090 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1091 func Test_interrupt_try() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1092 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1093 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1094 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1095 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1096 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1097 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1098 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1099 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1100 catch /^Vim:Interrupt$/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1101 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1102 endtry | Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1103 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1104 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1105 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1106 call assert_equal('abcd', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1107 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1108 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1109 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1110 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1111 func Test_interrupt_func_while_if() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1112 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1113 func F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1114 if 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1115 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1116 while 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1117 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1118 if 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1119 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1120 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1121 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1122 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1123 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1124 endif | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1125 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1126 endwhile | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1127 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1128 endif | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1129 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1130 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1131 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1132 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1133 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1134 call F() | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1135 catch /^Vim:Interrupt$/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1136 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1137 endtry | Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1138 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1139 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1140 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1141 call assert_equal('dabcefg', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1142 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1143 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1144 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1145 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1146 func Test_interrupt_func_try() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1147 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1148 func G() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1149 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1150 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1151 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1152 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1153 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1154 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1155 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1156 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1157 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1158 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1159 call G() | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1160 catch /^Vim:Interrupt$/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1161 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1162 endtry | Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1163 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1164 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1165 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1166 call assert_equal('bacde', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1167 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1168 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1169 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1170 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1171 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1172 " Test 19: Aborting on errors inside :try/:endtry {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1173 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1174 " An error in a command dynamically enclosed in a :try/:endtry region |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1175 " aborts script processing immediately. It does not matter whether |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1176 " the failing command is outside or inside a function and whether a |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1177 " function has an "abort" attribute. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1178 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1179 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1180 func Test_try_error_abort_1() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1181 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1182 func F() abort |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1183 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1184 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1185 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1186 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1187 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1188 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1189 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1190 call F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1191 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1192 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1193 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1194 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1195 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1196 call assert_equal('ba', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1197 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1198 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1199 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1200 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1201 func Test_try_error_abort_2() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1202 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1203 func G() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1204 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1205 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1206 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1207 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1208 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1209 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1210 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1211 call G() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1212 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1213 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1214 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1215 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1216 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1217 call assert_equal('ba', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1218 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1219 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1220 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1221 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1222 func Test_try_error_abort_3() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1223 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1224 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1225 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1226 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1227 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1228 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1229 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1230 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1231 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1232 call assert_equal('a', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1233 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1234 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1235 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1236 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1237 func Test_try_error_abort_4() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1238 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1239 if 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1240 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1241 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1242 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1243 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1244 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1245 endif | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1246 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1247 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1248 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1249 call assert_equal('a', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1250 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1251 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1252 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1253 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1254 func Test_try_error_abort_5() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1255 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1256 let p = 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1257 while p |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1258 let p = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1259 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1260 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1261 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1262 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1263 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1264 endwhile | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1265 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1266 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1267 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1268 call assert_equal('a', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1269 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1270 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1271 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1272 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1273 func Test_try_error_abort_6() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1274 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1275 let p = 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1276 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1277 while p |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1278 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1279 let p = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1280 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1281 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1282 endwhile | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1283 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1284 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1285 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1286 call assert_equal('abc', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1287 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1288 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1289 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1290 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1291 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1292 " Test 20: Aborting on errors after :try/:endtry {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1293 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1294 " When an error occurs after the last active :try/:endtry region has |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1295 " been left, termination behavior is as if no :try/:endtry has been |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1296 " seen. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1297 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1298 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1299 func Test_error_after_try_1() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1300 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1301 let p = 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1302 while p |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1303 let p = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1304 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1305 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1306 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1307 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1308 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1309 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1310 endwhile | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1311 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1312 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1313 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1314 call assert_equal('abc', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1315 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1316 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1317 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1318 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1319 func Test_error_after_try_2() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1320 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1321 while 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1322 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1323 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1324 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1325 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1326 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1327 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1328 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1329 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1330 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1331 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1332 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1333 call assert_equal('abc', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1334 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1335 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1336 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1337 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1338 func Test_error_after_try_3() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1339 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1340 while 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1341 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1342 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1343 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1344 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1345 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1346 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1347 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1348 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1349 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1350 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1351 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1352 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1353 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1354 call assert_equal('abcd', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1355 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1356 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1357 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1358 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1359 func Test_error_after_try_4() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1360 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1361 while 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1362 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1363 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1364 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1365 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1366 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1367 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1368 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1369 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1370 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1371 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1372 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1373 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1374 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1375 call assert_equal('abcd', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1376 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1377 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1378 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1379 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1380 func Test_error_after_try_5() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1381 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1382 let p = 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1383 while p |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1384 let p = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1385 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1386 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1387 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1388 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1389 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1390 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1391 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1392 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1393 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1394 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1395 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1396 call assert_equal('abc', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1397 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1398 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1399 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1400 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1401 func Test_error_after_try_6() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1402 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1403 let p = 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1404 while p |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1405 let p = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1406 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1407 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1408 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1409 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1410 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1411 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1412 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1413 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1414 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1415 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1416 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1417 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1418 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1419 call assert_equal('abcd', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1420 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1421 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1422 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1423 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1424 func Test_error_after_try_7() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1425 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1426 let p = 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1427 while p |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1428 let p = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1429 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1430 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1431 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1432 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1433 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1434 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1435 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1436 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1437 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1438 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1439 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1440 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1441 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1442 call assert_equal('abcd', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1443 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1444 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1445 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1446 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1447 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1448 " Test 21: :finally for :try after :continue/:break/:return/:finish {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1449 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1450 " If a :try conditional stays inactive due to a preceding :continue, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1451 " :break, :return, or :finish, its :finally clause should not be |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1452 " executed. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1453 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1454 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1455 func Test_finally_after_loop_ctrl_statement() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1456 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1457 func F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1458 let loops = 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1459 while loops > 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1460 XloopNEXT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1461 let loops = loops - 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1462 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1463 if loops == 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1464 Xloop 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1465 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1466 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1467 elseif loops == 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1468 Xloop 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1469 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1470 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1471 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1472 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1473 try " inactive |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1474 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1475 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1476 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1477 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1478 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1479 Xloop 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1480 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1481 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1482 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1483 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1484 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1485 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1486 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1487 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1488 try " inactive |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1489 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1490 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1491 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1492 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1493 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1494 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1495 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1496 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1497 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1498 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1499 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1500 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1501 call F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1502 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1503 finish |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1504 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1505 try " inactive |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1506 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1507 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1508 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1509 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1510 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1511 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1512 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1513 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1514 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1515 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1516 call assert_equal('fa2c2b3c3degh', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1517 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1518 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1519 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1520 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1521 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1522 " Test 22: :finally for a :try after an error/interrupt/:throw {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1523 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1524 " If a :try conditional stays inactive due to a preceding error or |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1525 " interrupt or :throw, its :finally clause should not be executed. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1526 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1527 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1528 func Test_finally_after_error_in_func() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1529 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1530 func Error() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1531 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1532 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1533 asdf " aborting error, triggering error exception |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1534 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1535 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1536 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1537 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1538 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1539 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1540 call Error() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1541 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1542 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1543 if 1 " not active due to error |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1544 try " not active since :if inactive |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1545 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1546 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1547 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1548 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1549 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1550 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1551 try " not active due to error |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1552 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1553 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1554 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1555 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1556 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1557 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1558 call assert_equal('ab', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1559 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1560 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1561 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1562 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1563 func Test_finally_after_interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1564 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1565 func Interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1566 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1567 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1568 call interrupt() " triggering interrupt exception |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1569 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1570 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1571 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1572 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1573 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1574 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1575 call Interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1576 catch /^Vim:Interrupt$/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1577 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1578 finish |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1579 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1580 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1581 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1582 if 1 " not active due to interrupt |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1583 try " not active since :if inactive |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1584 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1585 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1586 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1587 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1588 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1589 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1590 try " not active due to interrupt |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1591 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1592 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1593 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1594 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1595 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1596 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1597 call assert_equal('bac', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1598 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1599 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1600 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1601 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1602 func Test_finally_after_throw() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1603 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1604 func Throw() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1605 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1606 throw 'xyz' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1607 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1608 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1609 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1610 call Throw() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1611 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1612 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1613 if 1 " not active due to :throw |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1614 try " not active since :if inactive |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1615 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1616 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1617 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1618 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1619 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1620 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1621 try " not active due to :throw |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1622 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1623 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1624 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1625 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1626 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1627 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1628 call assert_equal('ba', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1629 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1630 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1631 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1632 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1633 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1634 " Test 23: :catch clauses for a :try after a :throw {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1635 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1636 " If a :try conditional stays inactive due to a preceding :throw, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1637 " none of its :catch clauses should be executed. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1638 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1639 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1640 func Test_catch_after_throw() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1641 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1642 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1643 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1644 throw "xyz" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1645 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1646 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1647 if 1 " not active due to :throw |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1648 try " not active since :if inactive |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1649 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1650 catch /xyz/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1651 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1652 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1653 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1654 catch /xyz/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1655 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1656 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1657 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1658 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1659 throw "abc" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1660 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1661 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1662 try " not active due to :throw |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1663 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1664 catch /abc/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1665 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1666 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1667 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1668 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1669 call assert_equal('abc', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1670 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1671 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1672 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1673 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1674 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1675 " Test 24: :endtry for a :try after a :throw {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1676 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1677 " If a :try conditional stays inactive due to a preceding :throw, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1678 " its :endtry should not rethrow the exception to the next surrounding |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1679 " active :try conditional. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1680 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1681 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1682 func Test_endtry_after_throw() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1683 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1684 try " try 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1685 try " try 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1686 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1687 throw "xyz" " makes try 2 inactive |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1688 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1689 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1690 try " try 3 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1691 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1692 endtry " no rethrow to try 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1693 catch /xyz/ " should catch although try 2 inactive |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1694 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1695 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1696 catch /xyz/ " try 1 active, but exception already caught |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1697 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1698 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1699 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1700 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1701 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1702 call assert_equal('abc', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1703 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1704 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1705 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1706 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1707 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1708 " Test 27: Executing :finally clauses after :return {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1709 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1710 " For a :return command dynamically enclosed in a :try/:endtry region, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1711 " :finally clauses are executed and the called function is ended. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1712 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1713 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1714 func T27_F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1715 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1716 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1717 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1718 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1719 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1720 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1721 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1722 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1723 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1724 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1725 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1726 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1727 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1728 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1729 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1730 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1731 func T27_G() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1732 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1733 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1734 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1735 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1736 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1737 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1738 call T27_F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1739 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1740 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1741 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1742 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1743 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1744 func T27_H() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1745 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1746 Xpath 'i' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1747 call T27_G() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1748 Xpath 'j' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1749 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1750 Xpath 'k' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1751 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1752 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1753 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1754 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1755 endfunction |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1756 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1757 func Test_finally_after_return() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1758 XpathINIT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1759 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1760 Xpath 'l' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1761 call T27_H() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1762 Xpath 'm' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1763 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1764 Xpath 'n' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1765 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1766 call assert_equal('lifgabcehjkmn', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1767 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1768 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1769 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1770 " Test 28: Executing :finally clauses after :finish {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1771 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1772 " For a :finish command dynamically enclosed in a :try/:endtry region, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1773 " :finally clauses are executed and the sourced file is finished. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1774 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1775 " This test executes the bodies of the functions F, G, and H from the |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1776 " previous test as script files (:return replaced by :finish). |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1777 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1778 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1779 func Test_finally_after_finish() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1780 XpathINIT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1781 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1782 let scriptF = MakeScript("T27_F") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1783 let scriptG = MakeScript("T27_G", scriptF) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1784 let scriptH = MakeScript("T27_H", scriptG) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1785 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1786 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1787 Xpath 'A' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1788 exec "source" scriptH |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1789 Xpath 'B' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1790 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1791 Xpath 'C' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1792 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1793 Xpath 'D' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1794 call assert_equal('AifgabcehjkBCD', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1795 call delete(scriptF) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1796 call delete(scriptG) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1797 call delete(scriptH) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1798 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1799 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1800 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1801 " Test 29: Executing :finally clauses on errors {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1802 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1803 " After an error in a command dynamically enclosed in a :try/:endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1804 " region, :finally clauses are executed and the script processing is |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1805 " terminated. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1806 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1807 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1808 func Test_finally_after_error_1() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1809 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1810 func F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1811 while 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1812 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1813 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1814 while 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1815 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1816 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1817 asdf " error |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1818 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1819 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1820 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1821 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1822 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1823 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1824 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1825 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1826 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1827 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1828 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1829 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1830 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1831 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1832 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1833 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1834 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1835 while 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1836 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1837 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1838 while 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1839 call F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1840 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1841 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1842 endwhile | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1843 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1844 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1845 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1846 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1847 endwhile | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1848 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1849 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1850 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1851 call assert_equal('eabcdf', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1852 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1853 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1854 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1855 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1856 func Test_finally_after_error_2() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1857 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1858 func G() abort |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1859 if 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1860 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1861 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1862 asdf " error |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1863 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1864 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1865 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1866 endtry | Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1867 endif | Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1868 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1869 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1870 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1871 if 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1872 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1873 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1874 call G() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1875 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1876 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1877 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1878 endtry | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1879 endif | call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1880 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1881 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1882 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1883 call assert_equal('eabf', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1884 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1885 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1886 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1887 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1888 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1889 " Test 30: Executing :finally clauses on interrupt {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1890 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1891 " After an interrupt in a command dynamically enclosed in |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1892 " a :try/:endtry region, :finally clauses are executed and the |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1893 " script processing is terminated. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1894 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1895 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1896 func Test_finally_on_interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1897 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1898 func F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1899 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1900 Xloop 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1901 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1902 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1903 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1904 Xloop 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1905 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1906 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1907 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1908 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1909 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1910 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1911 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1912 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1913 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1914 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1915 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1916 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1917 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1918 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1919 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1920 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1921 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1922 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1923 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1924 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1925 Xpath 'i' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1926 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1927 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1928 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1929 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1930 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1931 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1932 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1933 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1934 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1935 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1936 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1937 Xpath 'j' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1938 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1939 Xpath 'k' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1940 call F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1941 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1942 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1943 Xpath 'l' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1944 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1945 Xpath 'm' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1946 XloopNEXT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1947 ExecAsScript F |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1948 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1949 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1950 Xpath 'n' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1951 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1952 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1953 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1954 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1955 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1956 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1957 catch /^Vim:Interrupt$/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1958 Xpath 'o' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1959 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1960 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1961 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1962 call assert_equal('cdefghijka1b1lma2b2no', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1963 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1964 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1965 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1966 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1967 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1968 " Test 31: Executing :finally clauses after :throw {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1969 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1970 " After a :throw dynamically enclosed in a :try/:endtry region, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1971 " :finally clauses are executed and the script processing is |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1972 " terminated. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1973 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1974 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1975 func Test_finally_after_throw_2() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1976 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1977 func F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1978 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1979 Xloop 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1980 throw "exception" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1981 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1982 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1983 Xloop 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1984 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1985 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1986 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1987 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1988 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1989 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1990 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1991 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1992 throw "exception" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1993 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1994 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1995 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1996 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1997 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1998 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
1999 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2000 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2001 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2002 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2003 Xpath 'i' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2004 throw "exception" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2005 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2006 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2007 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2008 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2009 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2010 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2011 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2012 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2013 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2014 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2015 Xpath 'j' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2016 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2017 Xpath 'k' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2018 call F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2019 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2020 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2021 Xpath 'l' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2022 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2023 Xpath 'm' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2024 XloopNEXT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2025 ExecAsScript F |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2026 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2027 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2028 Xpath 'n' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2029 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2030 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2031 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2032 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2033 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2034 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2035 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2036 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2037 call assert_equal('cdefghijka1b1lma2b2n', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2038 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2039 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2040 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2041 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2042 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2043 " Test 34: :finally reason discarded by :continue {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2044 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2045 " When a :finally clause is executed due to a :continue, :break, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2046 " :return, :finish, error, interrupt or :throw, the jump reason is |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2047 " discarded by a :continue in the finally clause. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2048 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2049 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2050 func Test_finally_after_continue() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2051 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2052 func C(jump) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2053 XloopNEXT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2054 let loop = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2055 while loop < 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2056 let loop = loop + 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2057 if loop == 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2058 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2059 if a:jump == "continue" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2060 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2061 elseif a:jump == "break" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2062 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2063 elseif a:jump == "return" || a:jump == "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2064 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2065 elseif a:jump == "error" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2066 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2067 elseif a:jump == "interrupt" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2068 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2069 let dummy = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2070 elseif a:jump == "throw" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2071 throw "abc" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2072 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2073 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2074 continue " discards jump that caused the :finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2075 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2076 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2077 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2078 elseif loop == 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2079 Xloop 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2080 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2081 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2082 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2083 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2084 call C("continue") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2085 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2086 call C("break") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2087 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2088 call C("return") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2089 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2090 let g:jump = "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2091 ExecAsScript C |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2092 unlet g:jump |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2093 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2094 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2095 call C("error") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2096 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2097 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2098 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2099 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2100 call C("interrupt") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2101 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2102 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2103 Xpath 'i' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2104 call C("throw") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2105 Xpath 'j' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2106 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2107 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2108 Xpath 'k' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2109 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2110 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2111 call assert_equal('a2ba3ca4da5ea6fga7hia8jk', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2112 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2113 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2114 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2115 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2116 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2117 " Test 35: :finally reason discarded by :break {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2118 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2119 " When a :finally clause is executed due to a :continue, :break, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2120 " :return, :finish, error, interrupt or :throw, the jump reason is |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2121 " discarded by a :break in the finally clause. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2122 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2123 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2124 func Test_finally_discard_by_break() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2125 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2126 func B(jump) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2127 XloopNEXT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2128 let loop = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2129 while loop < 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2130 let loop = loop + 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2131 if loop == 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2132 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2133 if a:jump == "continue" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2134 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2135 elseif a:jump == "break" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2136 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2137 elseif a:jump == "return" || a:jump == "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2138 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2139 elseif a:jump == "error" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2140 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2141 elseif a:jump == "interrupt" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2142 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2143 let dummy = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2144 elseif a:jump == "throw" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2145 throw "abc" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2146 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2147 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2148 break " discards jump that caused the :finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2149 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2150 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2151 elseif loop == 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2152 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2153 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2154 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2155 Xloop 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2156 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2157 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2158 call B("continue") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2159 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2160 call B("break") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2161 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2162 call B("return") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2163 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2164 let g:jump = "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2165 ExecAsScript B |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2166 unlet g:jump |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2167 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2168 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2169 call B("error") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2170 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2171 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2172 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2173 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2174 call B("interrupt") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2175 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2176 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2177 Xpath 'i' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2178 call B("throw") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2179 Xpath 'j' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2180 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2181 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2182 Xpath 'k' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2183 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2184 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2185 call assert_equal('a2ba3ca4da5ea6fga7hia8jk', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2186 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2187 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2188 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2189 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2190 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2191 " Test 36: :finally reason discarded by :return {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2192 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2193 " When a :finally clause is executed due to a :continue, :break, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2194 " :return, :finish, error, interrupt or :throw, the jump reason is |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2195 " discarded by a :return in the finally clause. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2196 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2197 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2198 func Test_finally_discard_by_return() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2199 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2200 func R(jump, retval) abort |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2201 let loop = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2202 while loop < 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2203 let loop = loop + 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2204 if loop == 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2205 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2206 if a:jump == "continue" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2207 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2208 elseif a:jump == "break" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2209 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2210 elseif a:jump == "return" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2211 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2212 elseif a:jump == "error" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2213 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2214 elseif a:jump == "interrupt" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2215 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2216 let dummy = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2217 elseif a:jump == "throw" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2218 throw "abc" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2219 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2220 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2221 return a:retval " discards jump that caused the :finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2222 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2223 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2224 elseif loop == 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2225 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2226 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2227 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2228 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2229 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2230 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2231 let sum = -R("continue", -8) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2232 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2233 let sum = sum - R("break", -16) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2234 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2235 let sum = sum - R("return", -32) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2236 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2237 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2238 let sum = sum - R("error", -64) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2239 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2240 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2241 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2242 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2243 let sum = sum - R("interrupt", -128) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2244 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2245 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2246 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2247 let sum = sum - R("throw", -256) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2248 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2249 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2250 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2251 Xpath 'i' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2252 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2253 let expected = 8 + 16 + 32 + 64 + 128 + 256 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2254 call assert_equal(sum, expected) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2255 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2256 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2257 call assert_equal('abcdefghi', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2258 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2259 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2260 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2261 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2262 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2263 " Test 37: :finally reason discarded by :finish {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2264 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2265 " When a :finally clause is executed due to a :continue, :break, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2266 " :return, :finish, error, interrupt or :throw, the jump reason is |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2267 " discarded by a :finish in the finally clause. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2268 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2269 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2270 func Test_finally_discard_by_finish() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2271 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2272 func F(jump) " not executed as function, transformed to a script |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2273 let loop = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2274 while loop < 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2275 let loop = loop + 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2276 if loop == 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2277 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2278 if a:jump == "continue" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2279 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2280 elseif a:jump == "break" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2281 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2282 elseif a:jump == "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2283 finish |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2284 elseif a:jump == "error" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2285 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2286 elseif a:jump == "interrupt" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2287 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2288 let dummy = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2289 elseif a:jump == "throw" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2290 throw "abc" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2291 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2292 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2293 finish " discards jump that caused the :finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2294 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2295 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2296 elseif loop == 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2297 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2298 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2299 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2300 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2301 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2302 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2303 let scriptF = MakeScript("F") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2304 delfunction F |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2305 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2306 let g:jump = "continue" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2307 exec "source" scriptF |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2308 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2309 let g:jump = "break" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2310 exec "source" scriptF |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2311 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2312 let g:jump = "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2313 exec "source" scriptF |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2314 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2315 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2316 let g:jump = "error" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2317 exec "source" scriptF |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2318 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2319 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2320 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2321 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2322 let g:jump = "interrupt" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2323 exec "source" scriptF |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2324 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2325 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2326 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2327 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2328 let g:jump = "throw" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2329 exec "source" scriptF |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2330 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2331 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2332 Xpath 'i' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2333 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2334 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2335 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2336 unlet g:jump |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2337 call delete(scriptF) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2338 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2339 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2340 call assert_equal('abcdefghi', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2341 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2342 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2343 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2344 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2345 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2346 " Test 38: :finally reason discarded by an error {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2347 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2348 " When a :finally clause is executed due to a :continue, :break, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2349 " :return, :finish, error, interrupt or :throw, the jump reason is |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2350 " discarded by an error in the finally clause. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2351 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2352 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2353 func Test_finally_discard_by_error() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2354 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2355 func E(jump) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2356 let loop = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2357 while loop < 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2358 let loop = loop + 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2359 if loop == 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2360 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2361 if a:jump == "continue" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2362 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2363 elseif a:jump == "break" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2364 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2365 elseif a:jump == "return" || a:jump == "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2366 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2367 elseif a:jump == "error" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2368 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2369 elseif a:jump == "interrupt" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2370 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2371 let dummy = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2372 elseif a:jump == "throw" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2373 throw "abc" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2374 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2375 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2376 asdf " error; discards jump that caused the :finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2377 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2378 elseif loop == 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2379 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2380 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2381 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2382 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2383 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2384 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2385 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2386 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2387 call E("continue") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2388 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2389 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2390 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2391 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2392 call E("break") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2393 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2394 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2395 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2396 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2397 call E("return") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2398 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2399 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2400 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2401 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2402 let g:jump = "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2403 ExecAsScript E |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2404 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2405 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2406 unlet g:jump |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2407 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2408 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2409 call E("error") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2410 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2411 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2412 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2413 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2414 call E("interrupt") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2415 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2416 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2417 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2418 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2419 call E("throw") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2420 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2421 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2422 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2423 delfunction E |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2424 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2425 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2426 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2427 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2428 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2429 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2430 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2431 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2432 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2433 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2434 call assert_equal('abcdefgh', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2435 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2436 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2437 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2438 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2439 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2440 " Test 39: :finally reason discarded by an interrupt {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2441 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2442 " When a :finally clause is executed due to a :continue, :break, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2443 " :return, :finish, error, interrupt or :throw, the jump reason is |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2444 " discarded by an interrupt in the finally clause. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2445 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2446 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2447 func Test_finally_discarded_by_interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2448 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2449 func I(jump) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2450 let loop = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2451 while loop < 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2452 let loop = loop + 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2453 if loop == 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2454 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2455 if a:jump == "continue" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2456 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2457 elseif a:jump == "break" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2458 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2459 elseif a:jump == "return" || a:jump == "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2460 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2461 elseif a:jump == "error" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2462 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2463 elseif a:jump == "interrupt" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2464 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2465 let dummy = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2466 elseif a:jump == "throw" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2467 throw "abc" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2468 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2469 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2470 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2471 let dummy = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2472 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2473 elseif loop == 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2474 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2475 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2476 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2477 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2478 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2479 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2480 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2481 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2482 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2483 call I("continue") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2484 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2485 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2486 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2487 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2488 call I("break") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2489 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2490 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2491 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2492 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2493 call I("return") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2494 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2495 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2496 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2497 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2498 let g:jump = "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2499 ExecAsScript I |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2500 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2501 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2502 unlet g:jump |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2503 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2504 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2505 call I("error") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2506 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2507 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2508 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2509 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2510 call I("interrupt") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2511 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2512 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2513 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2514 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2515 call I("throw") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2516 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2517 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2518 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2519 delfunction I |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2520 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2521 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2522 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2523 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2524 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2525 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2526 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2527 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2528 catch /^Vim:Interrupt$/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2529 Xpath 'A' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2530 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2531 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2532 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2533 call assert_equal('abcdefghA', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2534 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2535 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2536 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2537 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2538 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2539 " Test 40: :finally reason discarded by :throw {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2540 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2541 " When a :finally clause is executed due to a :continue, :break, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2542 " :return, :finish, error, interrupt or :throw, the jump reason is |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2543 " discarded by a :throw in the finally clause. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2544 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2545 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2546 func Test_finally_discard_by_throw() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2547 let test =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2548 func T(jump) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2549 let loop = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2550 while loop < 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2551 let loop = loop + 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2552 if loop == 1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2553 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2554 if a:jump == "continue" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2555 continue |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2556 elseif a:jump == "break" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2557 break |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2558 elseif a:jump == "return" || a:jump == "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2559 return |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2560 elseif a:jump == "error" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2561 asdf |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2562 elseif a:jump == "interrupt" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2563 call interrupt() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2564 let dummy = 0 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2565 elseif a:jump == "throw" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2566 throw "abc" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2567 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2568 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2569 throw "xyz" " discards jump that caused the :finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2570 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2571 elseif loop == 2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2572 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2573 endif |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2574 endwhile |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2575 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2576 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2577 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2578 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2579 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2580 call T("continue") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2581 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2582 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2583 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2584 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2585 call T("break") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2586 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2587 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2588 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2589 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2590 call T("return") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2591 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2592 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2593 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2594 Xpath 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2595 let g:jump = "finish" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2596 ExecAsScript T |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2597 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2598 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2599 unlet g:jump |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2600 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2601 Xpath 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2602 call T("error") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2603 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2604 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2605 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2606 Xpath 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2607 call T("interrupt") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2608 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2609 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2610 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2611 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2612 call T("throw") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2613 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2614 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2615 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2616 delfunction T |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2617 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2618 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2619 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2620 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2621 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2622 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2623 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2624 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2625 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2626 let verify =<< trim [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2627 call assert_equal('abcdefgh', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2628 [CODE] |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2629 call RunInNewVim(test, verify) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2630 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2631 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2632 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2633 " Test 49: Throwing exceptions across functions {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2634 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2635 " When an exception is thrown but not caught inside a function, the |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2636 " caller is checked for a matching :catch clause. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2637 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2638 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2639 func T49_C() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2640 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2641 Xpath 'a' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2642 throw "arrgh" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2643 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2644 catch /arrgh/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2645 Xpath 'b' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2646 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2647 Xpath 'c' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2648 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2649 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2650 func T49_T1() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2651 XloopNEXT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2652 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2653 Xloop 'd' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2654 throw "arrgh" |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2655 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2656 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2657 Xloop 'e' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2658 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2659 Xloop 'f' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2660 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2661 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2662 func T49_T2() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2663 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2664 Xpath 'g' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2665 call T49_T1() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2666 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2667 finally |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2668 Xpath 'h' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2669 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2670 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2671 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2672 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2673 func Test_throw_exception_across_funcs() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2674 XpathINIT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2675 XloopINIT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2676 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2677 Xpath 'i' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2678 call T49_C() " throw and catch |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2679 Xpath 'j' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2680 catch /.*/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2681 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2682 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2683 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2684 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2685 Xpath 'k' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2686 call T49_T1() " throw, one level |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2687 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2688 catch /arrgh/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2689 Xpath 'l' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2690 catch /.*/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2691 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2692 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2693 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2694 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2695 Xpath 'm' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2696 call T49_T2() " throw, two levels |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2697 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2698 catch /arrgh/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2699 Xpath 'n' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2700 catch /.*/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2701 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2702 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2703 Xpath 'o' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2704 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2705 call assert_equal('iabcjkd2e2lmgd3e3hno', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2706 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2707 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2708 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2709 " Test 50: Throwing exceptions across script files {{{1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2710 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2711 " When an exception is thrown but not caught inside a script file, |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2712 " the sourcing script or function is checked for a matching :catch |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2713 " clause. |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2714 " |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2715 " This test executes the bodies of the functions C, T1, and T2 from |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2716 " the previous test as script files (:return replaced by :finish). |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2717 "------------------------------------------------------------------------------- |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2718 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2719 func T50_F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2720 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2721 Xpath 'A' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2722 exec "source" g:scriptC |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2723 Xpath 'B' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2724 catch /.*/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2725 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2726 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2727 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2728 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2729 Xpath 'C' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2730 exec "source" g:scriptT1 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2731 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2732 catch /arrgh/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2733 Xpath 'D' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2734 catch /.*/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2735 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2736 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2737 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2738 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2739 func Test_throw_across_script() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2740 XpathINIT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2741 XloopINIT |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2742 let g:scriptC = MakeScript("T49_C") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2743 let g:scriptT1 = MakeScript("T49_T1") |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2744 let scriptT2 = MakeScript("T49_T2", g:scriptT1) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2745 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2746 try |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2747 Xpath 'E' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2748 call T50_F() |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2749 Xpath 'F' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2750 exec "source" scriptT2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2751 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2752 catch /arrgh/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2753 Xpath 'G' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2754 catch /.*/ |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2755 call assert_report('should not get here') |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2756 endtry |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2757 Xpath 'H' |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2758 call assert_equal('EAabcBCd2e2DFgd3e3hGH', g:Xpath) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2759 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2760 call delete(g:scriptC) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2761 call delete(g:scriptT1) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2762 call delete(scriptT2) |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2763 unlet g:scriptC g:scriptT1 scriptT2 |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2764 endfunc |
792398a9fe39
patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21110
diff
changeset
|
2765 |
18504
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2766 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2767 " Test 87 using (expr) ? funcref : funcref {{{1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2768 " |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2769 " Vim needs to correctly parse the funcref and even when it does |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2770 " not execute the funcref, it needs to consume the trailing () |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2771 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2772 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2773 func Add2(x1, x2) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2774 return a:x1 + a:x2 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2775 endfu |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2776 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2777 func GetStr() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2778 return "abcdefghijklmnopqrstuvwxyp" |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2779 endfu |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2780 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2781 func Test_funcref_with_condexpr() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2782 call assert_equal(5, function('Add2')(2,3)) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2783 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2784 call assert_equal(3, 1 ? function('Add2')(1,2) : function('Add2')(2,3)) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2785 call assert_equal(5, 0 ? function('Add2')(1,2) : function('Add2')(2,3)) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2786 " Make sure, GetStr() still works. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2787 call assert_equal('abcdefghijk', GetStr()[0:10]) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2788 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2789 |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2790 " Test 90: Recognizing {} in variable name. {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2791 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2792 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2793 func Test_curlies() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2794 let s:var = 66 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2795 let ns = 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2796 call assert_equal(66, {ns}:var) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2797 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2798 let g:a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2799 let g:b = 't' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2800 let g:a[g:b] = 77 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2801 call assert_equal(77, g:a['t']) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2802 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2803 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2804 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2805 " Test 91: using type(). {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2806 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2807 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2808 func Test_type() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2809 call assert_equal(0, type(0)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2810 call assert_equal(1, type("")) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2811 call assert_equal(2, type(function("tr"))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2812 call assert_equal(2, type(function("tr", [8]))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2813 call assert_equal(3, type([])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2814 call assert_equal(4, type({})) |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
2815 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
2816 call assert_equal(5, type(0.0)) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
2817 endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2818 call assert_equal(6, type(v:false)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2819 call assert_equal(6, type(v:true)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2820 call assert_equal(7, type(v:none)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2821 call assert_equal(7, type(v:null)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2822 call assert_equal(8, v:t_job) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2823 call assert_equal(9, v:t_channel) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2824 call assert_equal(v:t_number, type(0)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2825 call assert_equal(v:t_string, type("")) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2826 call assert_equal(v:t_func, type(function("tr"))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2827 call assert_equal(v:t_func, type(function("tr", [8]))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2828 call assert_equal(v:t_list, type([])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2829 call assert_equal(v:t_dict, type({})) |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
2830 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
2831 call assert_equal(v:t_float, type(0.0)) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
2832 endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2833 call assert_equal(v:t_bool, type(v:false)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2834 call assert_equal(v:t_bool, type(v:true)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2835 call assert_equal(v:t_none, type(v:none)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2836 call assert_equal(v:t_none, type(v:null)) |
20158
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2837 call assert_equal(v:t_string, type(test_null_string())) |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2838 call assert_equal(v:t_func, type(test_null_function())) |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2839 call assert_equal(v:t_func, type(test_null_partial())) |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2840 call assert_equal(v:t_list, type(test_null_list())) |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2841 call assert_equal(v:t_dict, type(test_null_dict())) |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2842 if has('job') |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2843 call assert_equal(v:t_job, type(test_null_job())) |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2844 endif |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2845 if has('channel') |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2846 call assert_equal(v:t_channel, type(test_null_channel())) |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2847 endif |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
2848 call assert_equal(v:t_blob, type(test_null_blob())) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2849 |
19548
9a9ca0e622c8
patch 8.2.0331: internal error when using test_void() and test_unknown()
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
2850 call assert_fails("call type(test_void())", 'E685:') |
9a9ca0e622c8
patch 8.2.0331: internal error when using test_void() and test_unknown()
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
2851 call assert_fails("call type(test_unknown())", 'E685:') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2852 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2853 call assert_equal(0, 0 + v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2854 call assert_equal(1, 0 + v:true) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2855 call assert_equal(0, 0 + v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2856 call assert_equal(0, 0 + v:null) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2857 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2858 call assert_equal('v:false', '' . v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2859 call assert_equal('v:true', '' . v:true) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2860 call assert_equal('v:none', '' . v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2861 call assert_equal('v:null', '' . v:null) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2862 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2863 call assert_true(v:false == 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2864 call assert_false(v:false != 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2865 call assert_true(v:true == 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2866 call assert_false(v:true != 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2867 call assert_false(v:true == v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2868 call assert_true(v:true != v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2869 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2870 call assert_true(v:null == 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2871 call assert_false(v:null != 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2872 call assert_true(v:none == 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2873 call assert_false(v:none != 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2874 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2875 call assert_true(v:false is v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2876 call assert_true(v:true is v:true) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2877 call assert_true(v:none is v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2878 call assert_true(v:null is v:null) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2879 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2880 call assert_false(v:false isnot v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2881 call assert_false(v:true isnot v:true) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2882 call assert_false(v:none isnot v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2883 call assert_false(v:null isnot v:null) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2884 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2885 call assert_false(v:false is 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2886 call assert_false(v:true is 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2887 call assert_false(v:true is v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2888 call assert_false(v:none is 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2889 call assert_false(v:null is 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2890 call assert_false(v:null is v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2891 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2892 call assert_true(v:false isnot 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2893 call assert_true(v:true isnot 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2894 call assert_true(v:true isnot v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2895 call assert_true(v:none isnot 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2896 call assert_true(v:null isnot 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2897 call assert_true(v:null isnot v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2898 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2899 call assert_equal(v:false, eval(string(v:false))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2900 call assert_equal(v:true, eval(string(v:true))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2901 call assert_equal(v:none, eval(string(v:none))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2902 call assert_equal(v:null, eval(string(v:null))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2903 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2904 call assert_equal(v:false, copy(v:false)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2905 call assert_equal(v:true, copy(v:true)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2906 call assert_equal(v:none, copy(v:none)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2907 call assert_equal(v:null, copy(v:null)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2908 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2909 call assert_equal([v:false], deepcopy([v:false])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2910 call assert_equal([v:true], deepcopy([v:true])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2911 call assert_equal([v:none], deepcopy([v:none])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2912 call assert_equal([v:null], deepcopy([v:null])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2913 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2914 call assert_true(empty(v:false)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2915 call assert_false(empty(v:true)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2916 call assert_true(empty(v:null)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2917 call assert_true(empty(v:none)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2918 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2919 func ChangeYourMind() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
2920 try |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
2921 return v:true |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
2922 finally |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
2923 return 'something else' |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
2924 endtry |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2925 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2926 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2927 call ChangeYourMind() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2928 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2929 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2930 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2931 " Test 92: skipping code {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2932 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2933 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2934 func Test_skip() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2935 let Fn = function('Test_type') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2936 call assert_false(0 && Fn[1]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2937 call assert_false(0 && string(Fn)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2938 call assert_false(0 && len(Fn)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2939 let l = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2940 call assert_false(0 && l[1]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2941 call assert_false(0 && string(l)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2942 call assert_false(0 && len(l)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2943 let f = 1.0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2944 call assert_false(0 && f[1]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2945 call assert_false(0 && string(f)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2946 call assert_false(0 && len(f)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2947 let sp = v:null |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2948 call assert_false(0 && sp[1]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2949 call assert_false(0 && string(sp)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2950 call assert_false(0 && len(sp)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2951 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2952 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2953 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2954 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2955 " Test 93: :echo and string() {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2956 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2957 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2958 func Test_echo_and_string() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2959 " String |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2960 let a = 'foo bar' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2961 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2962 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2963 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2964 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2965 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2966 call assert_equal(["foo bar", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2967 \ "'foo bar'"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2968 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2969 " Float |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2970 if has('float') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2971 let a = -1.2e0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2972 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2973 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2974 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2975 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2976 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2977 call assert_equal(["-1.2", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2978 \ "-1.2"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2979 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2980 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2981 " Funcref |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2982 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2983 echo function('string') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2984 echo string(function('string')) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2985 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2986 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2987 call assert_equal(["string", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2988 \ "function('string')"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2989 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2990 " Recursive dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2991 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2992 let a["a"] = a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2993 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2994 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2995 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2996 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2997 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2998 call assert_equal(["{'a': {...}}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2999 \ "{'a': {...}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3000 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3001 " Recursive list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3002 let a = [0] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3003 let a[0] = a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3004 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3005 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3006 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3007 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3008 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3009 call assert_equal(["[[...]]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3010 \ "[[...]]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3011 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3012 " Empty dictionaries in a list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3013 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3014 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3015 echo [a, a, a] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3016 echo string([a, a, a]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3017 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3018 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3019 call assert_equal(["[{}, {}, {}]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3020 \ "[{}, {}, {}]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3021 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3022 " Empty dictionaries in a dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3023 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3024 let b = {"a": a, "b": a} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3025 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3026 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3027 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3028 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3029 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3030 call assert_equal(["{'a': {}, 'b': {}}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3031 \ "{'a': {}, 'b': {}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3032 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3033 " Empty lists in a list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3034 let a = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3035 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3036 echo [a, a, a] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3037 echo string([a, a, a]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3038 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3039 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3040 call assert_equal(["[[], [], []]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3041 \ "[[], [], []]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3042 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3043 " Empty lists in a dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3044 let a = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3045 let b = {"a": a, "b": a} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3046 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3047 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3048 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3049 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3050 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3051 call assert_equal(["{'a': [], 'b': []}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3052 \ "{'a': [], 'b': []}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3053 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3054 " Dictionaries in a list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3055 let a = {"one": "yes", "two": "yes", "three": "yes"} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3056 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3057 echo [a, a, a] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3058 echo string([a, a, a]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3059 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3060 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3061 call assert_equal(["[{'one': 'yes', 'two': 'yes', 'three': 'yes'}, {...}, {...}]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3062 \ "[{'one': 'yes', 'two': 'yes', 'three': 'yes'}, {'one': 'yes', 'two': 'yes', 'three': 'yes'}, {'one': 'yes', 'two': 'yes', 'three': 'yes'}]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3063 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3064 " Dictionaries in a dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3065 let a = {"one": "yes", "two": "yes", "three": "yes"} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3066 let b = {"a": a, "b": a} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3067 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3068 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3069 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3070 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3071 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3072 call assert_equal(["{'a': {'one': 'yes', 'two': 'yes', 'three': 'yes'}, 'b': {...}}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3073 \ "{'a': {'one': 'yes', 'two': 'yes', 'three': 'yes'}, 'b': {'one': 'yes', 'two': 'yes', 'three': 'yes'}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3074 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3075 " Lists in a list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3076 let a = [1, 2, 3] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3077 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3078 echo [a, a, a] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3079 echo string([a, a, a]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3080 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3081 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3082 call assert_equal(["[[1, 2, 3], [...], [...]]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3083 \ "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3084 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3085 " Lists in a dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3086 let a = [1, 2, 3] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3087 let b = {"a": a, "b": a} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3088 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3089 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3090 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3091 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3092 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3093 call assert_equal(["{'a': [1, 2, 3], 'b': [...]}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3094 \ "{'a': [1, 2, 3], 'b': [1, 2, 3]}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3095 |
19991
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
3096 call assert_fails('echo &:', 'E112:') |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
3097 call assert_fails('echo &g:', 'E112:') |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
3098 call assert_fails('echo &l:', 'E112:') |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
3099 |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3100 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3101 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3102 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3103 " Test 94: 64-bit Numbers {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3104 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3105 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3106 func Test_num64() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3107 call assert_notequal( 4294967296, 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3108 call assert_notequal(-4294967296, 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3109 call assert_equal( 4294967296, 0xFFFFffff + 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3110 call assert_equal(-4294967296, -0xFFFFffff - 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3111 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3112 call assert_equal( 9223372036854775807, 1 / 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3113 call assert_equal(-9223372036854775807, -1 / 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3114 call assert_equal(-9223372036854775807 - 1, 0 / 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3115 |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3116 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3117 call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150)) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3118 call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150)) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3119 endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3120 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3121 let rng = range(0xFFFFffff, 0x100000001) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3122 call assert_equal([0xFFFFffff, 0x100000000, 0x100000001], rng) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3123 call assert_equal(0x100000001, max(rng)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3124 call assert_equal(0xFFFFffff, min(rng)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3125 call assert_equal(rng, sort(range(0x100000001, 0xFFFFffff, -1), 'N')) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3126 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3127 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3128 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3129 " Test 95: lines of :append, :change, :insert {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3130 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3131 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3132 function! DefineFunction(name, body) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3133 let func = join(['function! ' . a:name . '()'] + a:body + ['endfunction'], "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3134 exec func |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3135 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3136 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3137 func Test_script_lines() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3138 " :append |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3139 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3140 call DefineFunction('T_Append', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3141 \ 'append', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3142 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3143 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3144 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3145 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3146 call assert_report("Can't define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3147 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3148 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3149 call DefineFunction('T_Append', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3150 \ 'append', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3151 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3152 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3153 call assert_report("Shouldn't be able to define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3154 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3155 call assert_exception('Vim(function):E126: Missing :endfunction') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3156 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3157 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3158 " :change |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3159 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3160 call DefineFunction('T_Change', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3161 \ 'change', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3162 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3163 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3164 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3165 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3166 call assert_report("Can't define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3167 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3168 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3169 call DefineFunction('T_Change', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3170 \ 'change', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3171 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3172 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3173 call assert_report("Shouldn't be able to define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3174 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3175 call assert_exception('Vim(function):E126: Missing :endfunction') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3176 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3177 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3178 " :insert |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3179 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3180 call DefineFunction('T_Insert', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3181 \ 'insert', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3182 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3183 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3184 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3185 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3186 call assert_report("Can't define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3187 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3188 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3189 call DefineFunction('T_Insert', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3190 \ 'insert', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3191 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3192 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3193 call assert_report("Shouldn't be able to define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3194 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3195 call assert_exception('Vim(function):E126: Missing :endfunction') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3196 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3197 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3198 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3199 "------------------------------------------------------------------------------- |
11352
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
3200 " Test 96: line continuation {{{1 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
3201 " |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3202 " Undefined behavior was detected by ubsan with line continuation |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
3203 " after an empty line. |
11352
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
3204 "------------------------------------------------------------------------------- |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
3205 func Test_script_emty_line_continuation() |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
3206 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
3207 \ |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
3208 endfunc |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
3209 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
3210 "------------------------------------------------------------------------------- |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3211 " Test 97: bitwise functions {{{1 |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3212 "------------------------------------------------------------------------------- |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3213 func Test_bitwise_functions() |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3214 " and |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3215 call assert_equal(127, and(127, 127)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3216 call assert_equal(16, and(127, 16)) |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
3217 eval 127->and(16)->assert_equal(16) |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3218 call assert_equal(0, and(127, 128)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3219 call assert_fails("call and([], 1)", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3220 call assert_fails("call and({}, 1)", 'E728:') |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3221 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3222 call assert_fails("call and(1.0, 1)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3223 call assert_fails("call and(1, 1.0)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3224 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3225 call assert_fails("call and(1, [])", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3226 call assert_fails("call and(1, {})", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3227 " or |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3228 call assert_equal(23, or(16, 7)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3229 call assert_equal(15, or(8, 7)) |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
3230 eval 8->or(7)->assert_equal(15) |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3231 call assert_equal(123, or(0, 123)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3232 call assert_fails("call or([], 1)", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3233 call assert_fails("call or({}, 1)", 'E728:') |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3234 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3235 call assert_fails("call or(1.0, 1)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3236 call assert_fails("call or(1, 1.0)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3237 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3238 call assert_fails("call or(1, [])", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3239 call assert_fails("call or(1, {})", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3240 " xor |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3241 call assert_equal(0, xor(127, 127)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3242 call assert_equal(111, xor(127, 16)) |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
3243 eval 127->xor(16)->assert_equal(111) |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3244 call assert_equal(255, xor(127, 128)) |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3245 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3246 call assert_fails("call xor(1.0, 1)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3247 call assert_fails("call xor(1, 1.0)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3248 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3249 call assert_fails("call xor([], 1)", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3250 call assert_fails("call xor({}, 1)", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3251 call assert_fails("call xor(1, [])", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3252 call assert_fails("call xor(1, {})", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3253 " invert |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3254 call assert_equal(65408, and(invert(127), 65535)) |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
3255 eval 127->invert()->and(65535)->assert_equal(65408) |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3256 call assert_equal(65519, and(invert(16), 65535)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3257 call assert_equal(65407, and(invert(128), 65535)) |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3258 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3259 call assert_fails("call invert(1.0)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3260 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3261 call assert_fails("call invert([])", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3262 call assert_fails("call invert({})", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3263 endfunc |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3264 |
11547
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
3265 " Test using bang after user command {{{1 |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
3266 func Test_user_command_with_bang() |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
3267 command -bang Nieuw let nieuw = 1 |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
3268 Ni! |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
3269 call assert_equal(1, nieuw) |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
3270 unlet nieuw |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
3271 delcommand Nieuw |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
3272 endfunc |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
3273 |
19035
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3274 func Test_script_expand_sfile() |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3275 let lines =<< trim END |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3276 func s:snr() |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3277 return expand('<sfile>') |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3278 endfunc |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3279 let g:result = s:snr() |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3280 END |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3281 call writefile(lines, 'Xexpand') |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3282 source Xexpand |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3283 call assert_match('<SNR>\d\+_snr', g:result) |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3284 source Xexpand |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3285 call assert_match('<SNR>\d\+_snr', g:result) |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3286 |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3287 call delete('Xexpand') |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3288 unlet g:result |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3289 endfunc |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
3290 |
15790
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3291 func Test_compound_assignment_operators() |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3292 " Test for number |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3293 let x = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3294 let x += 10 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3295 call assert_equal(11, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3296 let x -= 5 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3297 call assert_equal(6, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3298 let x *= 4 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3299 call assert_equal(24, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3300 let x /= 3 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3301 call assert_equal(8, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3302 let x %= 3 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3303 call assert_equal(2, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3304 let x .= 'n' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3305 call assert_equal('2n', x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3306 |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3307 " Test special cases: division or modulus with 0. |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3308 let x = 1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3309 let x /= 0 |
19427
fdfe44ac6a1a
patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3310 call assert_equal(0x7FFFFFFFFFFFFFFF, x) |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3311 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3312 let x = -1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3313 let x /= 0 |
19427
fdfe44ac6a1a
patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3314 call assert_equal(-0x7FFFFFFFFFFFFFFF, x) |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3315 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3316 let x = 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3317 let x /= 0 |
19427
fdfe44ac6a1a
patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3318 call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x) |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3319 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3320 let x = 1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3321 let x %= 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3322 call assert_equal(0, x) |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3323 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3324 let x = -1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3325 let x %= 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3326 call assert_equal(0, x) |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3327 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3328 let x = 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3329 let x %= 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3330 call assert_equal(0, x) |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
3331 |
15790
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3332 " Test for string |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3333 let x = 'str' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3334 let x .= 'ing' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3335 call assert_equal('string', x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3336 let x += 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3337 call assert_equal(1, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3338 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3339 if has('float') |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3340 " Test for float |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3341 let x -= 1.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3342 call assert_equal(-0.5, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3343 let x = 0.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3344 let x += 4.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3345 call assert_equal(5.0, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3346 let x -= 1.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3347 call assert_equal(3.5, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3348 let x *= 3.0 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3349 call assert_equal(10.5, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3350 let x /= 2.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3351 call assert_equal(4.2, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3352 call assert_fails('let x %= 0.5', 'E734') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
3353 call assert_fails('let x .= "f"', 'E734') |
19724
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3354 let x = !3.14 |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3355 call assert_equal(0.0, x) |
20128
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3356 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3357 " integer and float operations |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3358 let x = 1 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3359 let x *= 2.1 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3360 call assert_equal(2.1, x) |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3361 let x = 1 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3362 let x /= 0.25 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3363 call assert_equal(4.0, x) |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3364 let x = 1 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3365 call assert_fails('let x %= 0.25', 'E734:') |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3366 let x = 1 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3367 call assert_fails('let x .= 0.25', 'E734:') |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3368 let x = 1.0 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3369 call assert_fails('let x += [1.1]', 'E734:') |
15790
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3370 endif |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3371 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3372 " Test for environment variable |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3373 let $FOO = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3374 call assert_fails('let $FOO += 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3375 call assert_fails('let $FOO -= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3376 call assert_fails('let $FOO *= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3377 call assert_fails('let $FOO /= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3378 call assert_fails('let $FOO %= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3379 let $FOO .= 's' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3380 call assert_equal('1s', $FOO) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3381 unlet $FOO |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3382 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3383 " Test for option variable (type: number) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3384 let &scrolljump = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3385 let &scrolljump += 5 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3386 call assert_equal(6, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3387 let &scrolljump -= 2 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3388 call assert_equal(4, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3389 let &scrolljump *= 3 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3390 call assert_equal(12, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3391 let &scrolljump /= 2 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3392 call assert_equal(6, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3393 let &scrolljump %= 5 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3394 call assert_equal(1, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3395 call assert_fails('let &scrolljump .= "j"', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3396 set scrolljump&vim |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3397 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3398 " Test for register |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3399 let @/ = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3400 call assert_fails('let @/ += 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3401 call assert_fails('let @/ -= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3402 call assert_fails('let @/ *= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3403 call assert_fails('let @/ /= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3404 call assert_fails('let @/ %= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3405 let @/ .= 's' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3406 call assert_equal('1s', @/) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3407 let @/ = '' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3408 endfunc |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3409 |
20093
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3410 func Test_unlet_env() |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3411 let $TESTVAR = 'yes' |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3412 call assert_equal('yes', $TESTVAR) |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3413 call assert_fails('lockvar $TESTVAR', 'E940') |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3414 call assert_fails('unlockvar $TESTVAR', 'E940') |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3415 call assert_equal('yes', $TESTVAR) |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3416 if 0 |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3417 unlet $TESTVAR |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3418 endif |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3419 call assert_equal('yes', $TESTVAR) |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3420 unlet $TESTVAR |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3421 call assert_equal('', $TESTVAR) |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3422 endfunc |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
3423 |
16078
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3424 func Test_refcount() |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3425 " Immediate values |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3426 call assert_equal(-1, test_refcount(1)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3427 call assert_equal(-1, test_refcount('s')) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3428 call assert_equal(-1, test_refcount(v:true)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3429 call assert_equal(0, test_refcount([])) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3430 call assert_equal(0, test_refcount({})) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3431 call assert_equal(0, test_refcount(0zff)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3432 call assert_equal(0, test_refcount({-> line('.')})) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3433 if has('float') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3434 call assert_equal(-1, test_refcount(0.1)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3435 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3436 if has('job') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3437 call assert_equal(0, test_refcount(job_start([&shell, &shellcmdflag, 'echo .']))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3438 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3439 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3440 " No refcount types |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3441 let x = 1 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3442 call assert_equal(-1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3443 let x = 's' |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3444 call assert_equal(-1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3445 let x = v:true |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3446 call assert_equal(-1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3447 if has('float') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3448 let x = 0.1 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3449 call assert_equal(-1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3450 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3451 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3452 " Check refcount |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3453 let x = [] |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3454 call assert_equal(1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3455 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3456 let x = {} |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
3457 call assert_equal(1, x->test_refcount()) |
16078
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3458 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3459 let x = 0zff |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3460 call assert_equal(1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3461 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3462 let X = {-> line('.')} |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3463 call assert_equal(1, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3464 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3465 call assert_equal(2, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3466 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3467 if has('job') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3468 let job = job_start([&shell, &shellcmdflag, 'echo .']) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3469 call assert_equal(1, test_refcount(job)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3470 call assert_equal(1, test_refcount(job_getchannel(job))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3471 call assert_equal(1, test_refcount(job)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3472 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3473 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3474 " Function arguments, copying and unassigning |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3475 func ExprCheck(x, i) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3476 let i = a:i + 1 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3477 call assert_equal(i, test_refcount(a:x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3478 let Y = a:x |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3479 call assert_equal(i + 1, test_refcount(a:x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3480 call assert_equal(test_refcount(a:x), test_refcount(Y)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3481 let Y = 0 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3482 call assert_equal(i, test_refcount(a:x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3483 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3484 call ExprCheck([], 0) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3485 call ExprCheck({}, 0) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3486 call ExprCheck(0zff, 0) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3487 call ExprCheck({-> line('.')}, 0) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3488 if has('job') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3489 call ExprCheck(job, 1) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3490 call ExprCheck(job_getchannel(job), 1) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3491 call job_stop(job) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3492 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3493 delfunc ExprCheck |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3494 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3495 " Regarding function |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3496 func Func(x) abort |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3497 call assert_equal(2, test_refcount(function('Func'))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3498 call assert_equal(0, test_refcount(funcref('Func'))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3499 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3500 call assert_equal(1, test_refcount(function('Func'))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3501 call assert_equal(0, test_refcount(function('Func', [1]))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3502 call assert_equal(0, test_refcount(funcref('Func'))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3503 call assert_equal(0, test_refcount(funcref('Func', [1]))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3504 let X = function('Func') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3505 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3506 call assert_equal(1, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3507 let X = function('Func', [1]) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3508 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3509 call assert_equal(2, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3510 let X = funcref('Func') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3511 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3512 call assert_equal(2, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3513 let X = funcref('Func', [1]) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3514 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3515 call assert_equal(2, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3516 unlet X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3517 unlet Y |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3518 call Func(1) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3519 delfunc Func |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3520 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3521 " Function with dict |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3522 func DictFunc() dict |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3523 call assert_equal(3, test_refcount(self)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3524 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3525 let d = {'Func': function('DictFunc')} |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3526 call assert_equal(1, test_refcount(d)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3527 call assert_equal(0, test_refcount(d.Func)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3528 call d.Func() |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3529 unlet d |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3530 delfunc DictFunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3531 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
3532 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3533 " Test for missing :endif, :endfor, :endwhile and :endtry {{{1 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3534 func Test_missing_end() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3535 call writefile(['if 2 > 1', 'echo ">"'], 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3536 call assert_fails('source Xscript', 'E171:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3537 call writefile(['for i in range(5)', 'echo i'], 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3538 call assert_fails('source Xscript', 'E170:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3539 call writefile(['while v:true', 'echo "."'], 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3540 call assert_fails('source Xscript', 'E170:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3541 call writefile(['try', 'echo "."'], 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3542 call assert_fails('source Xscript', 'E600:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3543 call delete('Xscript') |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3544 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3545 " Using endfor with :while |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3546 let caught_e732 = 0 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3547 try |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3548 while v:true |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3549 endfor |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3550 catch /E732:/ |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3551 let caught_e732 = 1 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3552 endtry |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3553 call assert_equal(1, caught_e732) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3554 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3555 " Using endwhile with :for |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3556 let caught_e733 = 0 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3557 try |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3558 for i in range(1) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3559 endwhile |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3560 catch /E733:/ |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3561 let caught_e733 = 1 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3562 endtry |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3563 call assert_equal(1, caught_e733) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3564 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3565 " Using endfunc with :if |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3566 call assert_fails('exe "if 1 | endfunc | endif"', 'E193:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3567 |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3568 " Missing 'in' in a :for statement |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
3569 call assert_fails('for i range(1) | endfor', 'E690:') |
20128
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3570 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3571 " Incorrect number of variables in for |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
3572 call assert_fails('for [i,] in range(3) | endfor', 'E475:') |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3573 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3574 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3575 " Test for deep nesting of if/for/while/try statements {{{1 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3576 func Test_deep_nest() |
20625
116c7bd5e980
patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents:
20158
diff
changeset
|
3577 CheckRunVimInTerminal |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3578 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3579 let lines =<< trim [SCRIPT] |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3580 " Deep nesting of if ... endif |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3581 func Test1() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3582 let @a = join(repeat(['if v:true'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3583 let @a ..= "\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3584 let @a ..= join(repeat(['endif'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3585 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3586 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3587 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3588 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3589 " Deep nesting of for ... endfor |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3590 func Test2() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3591 let @a = join(repeat(['for i in [1]'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3592 let @a ..= "\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3593 let @a ..= join(repeat(['endfor'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3594 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3595 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3596 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3597 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3598 " Deep nesting of while ... endwhile |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3599 func Test3() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3600 let @a = join(repeat(['while v:true'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3601 let @a ..= "\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3602 let @a ..= join(repeat(['endwhile'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3603 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3604 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3605 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3606 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3607 " Deep nesting of try ... endtry |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3608 func Test4() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3609 let @a = join(repeat(['try'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3610 let @a ..= "\necho v:true\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3611 let @a ..= join(repeat(['endtry'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3612 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3613 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3614 endfunc |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3615 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3616 " Deep nesting of function ... endfunction |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3617 func Test5() |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3618 let @a = join(repeat(['function X()'], 51), "\n") |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3619 let @a ..= "\necho v:true\n" |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3620 let @a ..= join(repeat(['endfunction'], 51), "\n") |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3621 @a |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3622 let @a = '' |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3623 endfunc |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3624 [SCRIPT] |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3625 call writefile(lines, 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3626 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3627 let buf = RunVimInTerminal('-S Xscript', {'rows': 6}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3628 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3629 " Deep nesting of if ... endif |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3630 call term_sendkeys(buf, ":call Test1()\n") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
3631 call TermWait(buf) |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3632 call WaitForAssert({-> assert_match('^E579:', term_getline(buf, 5))}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3633 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3634 " Deep nesting of for ... endfor |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3635 call term_sendkeys(buf, ":call Test2()\n") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
3636 call TermWait(buf) |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3637 call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3638 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3639 " Deep nesting of while ... endwhile |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3640 call term_sendkeys(buf, ":call Test3()\n") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
3641 call TermWait(buf) |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3642 call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3643 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3644 " Deep nesting of try ... endtry |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3645 call term_sendkeys(buf, ":call Test4()\n") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
3646 call TermWait(buf) |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3647 call WaitForAssert({-> assert_match('^E601:', term_getline(buf, 5))}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3648 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3649 " Deep nesting of function ... endfunction |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3650 call term_sendkeys(buf, ":call Test5()\n") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
3651 call TermWait(buf) |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3652 call WaitForAssert({-> assert_match('^E1058:', term_getline(buf, 4))}) |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3653 call term_sendkeys(buf, "\<C-C>\n") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
3654 call TermWait(buf) |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
3655 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3656 "let l = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3657 "for i in range(1, 6) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3658 " let l ..= term_getline(buf, i) . "\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3659 "endfor |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3660 "call assert_report(l) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3661 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3662 call StopVimInTerminal(buf) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3663 call delete('Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3664 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
3665 |
19724
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3666 " Test for errors in converting to float from various types {{{1 |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3667 func Test_float_conversion_errors() |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3668 if has('float') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3669 call assert_fails('let x = 4.0 % 2.0', 'E804') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3670 call assert_fails('echo 1.1[0]', 'E806') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3671 call assert_fails('echo sort([function("min"), 1], "f")', 'E891:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3672 call assert_fails('echo 3.2 == "vim"', 'E892:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3673 call assert_fails('echo sort([[], 1], "f")', 'E893:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3674 call assert_fails('echo sort([{}, 1], "f")', 'E894:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3675 call assert_fails('echo 3.2 == v:true', 'E362:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3676 call assert_fails('echo 3.2 == v:none', 'E907:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3677 endif |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3678 endfunc |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
3679 |
21110
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3680 " invalid function names {{{1 |
20109
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3681 func Test_invalid_function_names() |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3682 " function name not starting with capital |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3683 let caught_e128 = 0 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3684 try |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3685 func! g:test() |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3686 echo "test" |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3687 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3688 catch /E128:/ |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3689 let caught_e128 = 1 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3690 endtry |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3691 call assert_equal(1, caught_e128) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3692 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3693 " function name includes a colon |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3694 let caught_e884 = 0 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3695 try |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3696 func! b:test() |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3697 echo "test" |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3698 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3699 catch /E884:/ |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3700 let caught_e884 = 1 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3701 endtry |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3702 call assert_equal(1, caught_e884) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3703 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3704 " function name folowed by # |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3705 let caught_e128 = 0 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3706 try |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3707 func! test2() "# |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3708 echo "test2" |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3709 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3710 catch /E128:/ |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3711 let caught_e128 = 1 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3712 endtry |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3713 call assert_equal(1, caught_e128) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3714 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3715 " function name starting with/without "g:", buffer-local funcref. |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3716 function! g:Foo(n) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3717 return 'called Foo(' . a:n . ')' |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3718 endfunction |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3719 let b:my_func = function('Foo') |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3720 call assert_equal('called Foo(1)', b:my_func(1)) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3721 call assert_equal('called Foo(2)', g:Foo(2)) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3722 call assert_equal('called Foo(3)', Foo(3)) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3723 delfunc g:Foo |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3724 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3725 " script-local function used in Funcref must exist. |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3726 let lines =<< trim END |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3727 func s:Testje() |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3728 return "foo" |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3729 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3730 let Bar = function('s:Testje') |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3731 call assert_equal(0, exists('s:Testje')) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3732 call assert_equal(1, exists('*s:Testje')) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3733 call assert_equal(1, exists('Bar')) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3734 call assert_equal(1, exists('*Bar')) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3735 END |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3736 call writefile(lines, 'Xscript') |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3737 source Xscript |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3738 call delete('Xscript') |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3739 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3740 |
21110
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3741 " substring and variable name {{{1 |
20109
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3742 func Test_substring_var() |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3743 let str = 'abcdef' |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3744 let n = 3 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3745 call assert_equal('def', str[n:]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3746 call assert_equal('abcd', str[:n]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3747 call assert_equal('d', str[n:n]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3748 unlet n |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3749 let nn = 3 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3750 call assert_equal('def', str[nn:]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3751 call assert_equal('abcd', str[:nn]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3752 call assert_equal('d', str[nn:nn]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3753 unlet nn |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3754 let b:nn = 4 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3755 call assert_equal('ef', str[b:nn:]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3756 call assert_equal('abcde', str[:b:nn]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3757 call assert_equal('e', str[b:nn:b:nn]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3758 unlet b:nn |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3759 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
3760 |
21110
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3761 " Test using s: with a typed command {{{1 |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3762 func Test_typed_script_var() |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3763 CheckRunVimInTerminal |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3764 |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3765 let buf = RunVimInTerminal('', {'rows': 6}) |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3766 |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3767 " Deep nesting of if ... endif |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3768 call term_sendkeys(buf, ":echo get(s:, 'foo', 'x')\n") |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3769 call TermWait(buf) |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3770 call WaitForAssert({-> assert_match('^E116:', term_getline(buf, 5))}) |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3771 |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3772 call StopVimInTerminal(buf) |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3773 endfunc |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
3774 |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
3775 "------------------------------------------------------------------------------- |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3776 " Modelines {{{1 |
18504
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3777 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3778 "------------------------------------------------------------------------------- |