Mercurial > vim
annotate src/testdir/test_vimscript.vim @ 21666:97b887aecd4a v8.2.1383
patch 8.2.1383: test 49 is old style
Commit: https://github.com/vim/vim/commit/9470a4d88acf948af1596101527b3a505f8c14e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 7 16:49:11 2020 +0200
patch 8.2.1383: test 49 is old style
Problem: Test 49 is old style.
Solution: Convert test cases to new style. (Yegappan Lakshmanan,
closes #6638)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 07 Aug 2020 17:00:05 +0200 |
parents | 792398a9fe39 |
children | 078d98fe1c65 |
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 "------------------------------------------------------------------------------- |
21666
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2767 " Test 52: Uncaught exceptions {{{1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2768 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2769 " When an exception is thrown but not caught, an error message is |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2770 " displayed when the script is terminated. In case of an interrupt |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2771 " or error exception, the normal interrupt or error message(s) are |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2772 " displayed. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2773 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2774 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2775 func Test_uncaught_exception_1() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2776 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2777 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2778 let test =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2779 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2780 throw "arrgh" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2781 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2782 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2783 let verify =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2784 call assert_equal('E605: Exception not caught: arrgh', v:errmsg) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2785 call assert_equal('a', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2786 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2787 call RunInNewVim(test, verify) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2788 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2789 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2790 func Test_uncaught_exception_2() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2791 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2792 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2793 let test =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2794 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2795 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2796 throw "oops" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2797 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2798 catch /arrgh/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2799 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2800 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2801 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2802 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2803 let verify =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2804 call assert_equal('E605: Exception not caught: oops', v:errmsg) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2805 call assert_equal('a', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2806 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2807 call RunInNewVim(test, verify) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2808 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2809 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2810 func Test_uncaught_exception_3() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2811 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2812 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2813 let test =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2814 func T() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2815 Xpath 'c' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2816 throw "brrr" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2817 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2818 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2819 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2820 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2821 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2822 throw "arrgh" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2823 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2824 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2825 Xpath 'b' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2826 call T() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2827 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2828 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2829 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2830 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2831 let verify =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2832 call assert_equal('E605: Exception not caught: brrr', v:errmsg) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2833 call assert_equal('abc', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2834 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2835 call RunInNewVim(test, verify) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2836 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2837 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2838 func Test_uncaught_exception_4() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2839 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2840 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2841 let test =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2842 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2843 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2844 throw "arrgh" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2845 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2846 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2847 Xpath 'b' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2848 throw "brrr" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2849 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2850 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2851 call assert_report('should not get here')` |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2852 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2853 let verify =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2854 call assert_equal('E605: Exception not caught: brrr', v:errmsg) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2855 call assert_equal('ab', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2856 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2857 call RunInNewVim(test, verify) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2858 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2859 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2860 func Test_uncaught_exception_5() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2861 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2862 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2863 " Need to catch and handle interrupt, otherwise the test will wait for the |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2864 " user to press <Enter> to continue |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2865 let test =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2866 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2867 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2868 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2869 call interrupt() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2870 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2871 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2872 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2873 catch /^Vim:Interrupt$/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2874 Xpath 'b' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2875 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2876 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2877 let verify =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2878 call assert_equal('ab', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2879 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2880 call RunInNewVim(test, verify) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2881 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2882 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2883 func Test_uncaught_exception_6() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2884 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2885 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2886 let test =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2887 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2888 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2889 let x = novar " error E121; exception: E121 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2890 catch /E15:/ " should not catch |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2891 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2892 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2893 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2894 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2895 let verify =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2896 call assert_equal('a', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2897 call assert_equal('E121: Undefined variable: novar', v:errmsg) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2898 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2899 call RunInNewVim(test, verify) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2900 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2901 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2902 func Test_uncaught_exception_7() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2903 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2904 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2905 let test =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2906 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2907 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2908 " error E108/E488; exception: E488 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2909 unlet novar # |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2910 catch /E108:/ " should not catch |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2911 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2912 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2913 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2914 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2915 let verify =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2916 call assert_equal('a', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2917 call assert_equal('E488: Trailing characters: #', v:errmsg) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2918 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2919 call RunInNewVim(test, verify) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2920 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2921 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2922 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2923 " Test 53: Nesting errors: :endif/:else/:elseif {{{1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2924 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2925 " For nesting errors of :if conditionals the correct error messages |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2926 " should be given. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2927 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2928 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2929 func Test_nested_if_else_errors() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2930 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2931 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2932 " :endif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2933 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2934 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2935 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2936 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2937 call AssertException(['source Xtest'], 'Vim(endif):E580: :endif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2938 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2939 " :endif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2940 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2941 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2942 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2943 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2944 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2945 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2946 call AssertException(['source Xtest'], 'Vim(endif):E580: :endif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2947 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2948 " :endif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2949 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2950 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2951 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2952 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2953 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2954 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2955 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2956 call AssertException(['source Xtest'], 'Vim(endif):E580: :endif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2957 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2958 " :endif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2959 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2960 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2961 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2962 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2963 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2964 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2965 call AssertException(['source Xtest'], 'Vim(endif):E580: :endif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2966 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2967 " :endif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2968 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2969 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2970 throw "a" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2971 catch /a/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2972 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2973 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2974 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2975 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2976 call AssertException(['source Xtest'], 'Vim(endif):E580: :endif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2977 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2978 " :else without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2979 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2980 else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2981 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2982 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2983 call AssertException(['source Xtest'], 'Vim(else):E581: :else without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2984 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2985 " :else without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2986 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2987 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2988 else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2989 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2990 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2991 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2992 call AssertException(['source Xtest'], 'Vim(else):E581: :else without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2993 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2994 " :else without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2995 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2996 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2997 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2998 else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
2999 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3000 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3001 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3002 call AssertException(['source Xtest'], 'Vim(else):E581: :else without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3003 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3004 " :else without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3005 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3006 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3007 else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3008 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3009 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3010 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3011 call AssertException(['source Xtest'], 'Vim(else):E581: :else without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3012 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3013 " :else without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3014 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3015 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3016 throw "a" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3017 catch /a/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3018 else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3019 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3020 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3021 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3022 call AssertException(['source Xtest'], 'Vim(else):E581: :else without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3023 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3024 " :elseif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3025 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3026 elseif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3027 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3028 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3029 call AssertException(['source Xtest'], 'Vim(elseif):E582: :elseif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3030 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3031 " :elseif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3032 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3033 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3034 elseif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3035 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3036 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3037 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3038 call AssertException(['source Xtest'], 'Vim(elseif):E582: :elseif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3039 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3040 " :elseif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3041 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3042 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3043 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3044 elseif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3045 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3046 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3047 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3048 call AssertException(['source Xtest'], 'Vim(elseif):E582: :elseif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3049 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3050 " :elseif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3051 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3052 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3053 elseif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3054 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3055 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3056 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3057 call AssertException(['source Xtest'], 'Vim(elseif):E582: :elseif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3058 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3059 " :elseif without :if |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3060 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3061 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3062 throw "a" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3063 catch /a/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3064 elseif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3065 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3066 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3067 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3068 call AssertException(['source Xtest'], 'Vim(elseif):E582: :elseif without :if') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3069 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3070 " multiple :else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3071 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3072 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3073 else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3074 else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3075 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3076 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3077 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3078 call AssertException(['source Xtest'], 'Vim(else):E583: multiple :else') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3079 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3080 " :elseif after :else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3081 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3082 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3083 else |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3084 elseif 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3085 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3086 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3087 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3088 call AssertException(['source Xtest'], 'Vim(elseif):E584: :elseif after :else') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3089 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3090 call delete('Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3091 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3092 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3093 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3094 " Test 54: Nesting errors: :while/:endwhile {{{1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3095 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3096 " For nesting errors of :while conditionals the correct error messages |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3097 " should be given. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3098 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3099 " This test reuses the function MESSAGES() from the previous test. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3100 " This functions checks the messages in g:msgfile. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3101 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3102 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3103 func Test_nested_while_error() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3104 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3105 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3106 " :endwhile without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3107 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3108 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3109 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3110 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3111 call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3112 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3113 " :endwhile without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3114 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3115 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3116 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3117 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3118 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3119 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3120 call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3121 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3122 " Missing :endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3123 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3124 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3125 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3126 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3127 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3128 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3129 call AssertException(['source Xtest'], 'Vim(endwhile):E171: Missing :endif') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3130 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3131 " :endwhile without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3132 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3133 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3134 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3135 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3136 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3137 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3138 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3139 call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3140 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3141 " Missing :endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3142 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3143 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3144 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3145 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3146 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3147 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3148 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3149 call AssertException(['source Xtest'], 'Vim(endwhile):E600: Missing :endtry') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3150 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3151 " Missing :endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3152 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3153 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3154 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3155 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3156 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3157 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3158 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3159 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3160 call AssertException(['source Xtest'], 'Vim(endwhile):E600: Missing :endtry') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3161 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3162 " Missing :endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3163 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3164 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3165 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3166 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3167 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3168 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3169 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3170 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3171 call AssertException(['source Xtest'], 'Vim(endwhile):E171: Missing :endif') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3172 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3173 " :endwhile without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3174 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3175 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3176 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3177 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3178 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3179 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3180 call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3181 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3182 " :endwhile without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3183 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3184 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3185 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3186 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3187 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3188 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3189 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3190 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3191 call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3192 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3193 " :endwhile without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3194 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3195 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3196 throw "a" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3197 catch /a/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3198 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3199 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3200 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3201 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3202 call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3203 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3204 " :endwhile without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3205 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3206 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3207 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3208 throw "a" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3209 catch /a/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3210 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3211 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3212 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3213 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3214 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3215 call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3216 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3217 call delete('Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3218 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3219 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3220 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3221 " Test 55: Nesting errors: :continue/:break {{{1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3222 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3223 " For nesting errors of :continue and :break commands the correct |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3224 " error messages should be given. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3225 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3226 " This test reuses the function MESSAGES() from the previous test. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3227 " This functions checks the messages in g:msgfile. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3228 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3229 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3230 func Test_nested_cont_break_error() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3231 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3232 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3233 " :continue without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3234 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3235 continue |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3236 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3237 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3238 call AssertException(['source Xtest'], 'Vim(continue):E586: :continue without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3239 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3240 " :continue without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3241 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3242 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3243 continue |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3244 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3245 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3246 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3247 call AssertException(['source Xtest'], 'Vim(continue):E586: :continue without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3248 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3249 " :continue without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3250 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3251 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3252 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3253 continue |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3254 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3255 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3256 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3257 call AssertException(['source Xtest'], 'Vim(continue):E586: :continue without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3258 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3259 " :continue without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3260 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3261 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3262 continue |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3263 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3264 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3265 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3266 call AssertException(['source Xtest'], 'Vim(continue):E586: :continue without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3267 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3268 " :continue without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3269 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3270 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3271 throw "a" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3272 catch /a/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3273 continue |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3274 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3275 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3276 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3277 call AssertException(['source Xtest'], 'Vim(continue):E586: :continue without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3278 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3279 " :break without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3280 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3281 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3282 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3283 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3284 call AssertException(['source Xtest'], 'Vim(break):E587: :break without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3285 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3286 " :break without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3287 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3288 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3289 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3290 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3291 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3292 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3293 call AssertException(['source Xtest'], 'Vim(break):E587: :break without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3294 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3295 " :break without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3296 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3297 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3298 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3299 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3300 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3301 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3302 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3303 call AssertException(['source Xtest'], 'Vim(break):E587: :break without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3304 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3305 " :break without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3306 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3307 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3308 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3309 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3310 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3311 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3312 call AssertException(['source Xtest'], 'Vim(break):E587: :break without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3313 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3314 " :break without :while |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3315 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3316 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3317 throw "a" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3318 catch /a/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3319 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3320 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3321 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3322 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3323 call AssertException(['source Xtest'], 'Vim(break):E587: :break without :while or :for') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3324 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3325 call delete('Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3326 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3327 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3328 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3329 " Test 56: Nesting errors: :endtry {{{1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3330 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3331 " For nesting errors of :try conditionals the correct error messages |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3332 " should be given. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3333 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3334 " This test reuses the function MESSAGES() from the previous test. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3335 " This functions checks the messages in g:msgfile. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3336 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3337 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3338 func Test_nested_endtry_error() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3339 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3340 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3341 " :endtry without :try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3342 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3343 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3344 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3345 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3346 call AssertException(['source Xtest'], 'Vim(endtry):E602: :endtry without :try') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3347 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3348 " :endtry without :try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3349 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3350 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3351 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3352 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3353 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3354 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3355 call AssertException(['source Xtest'], 'Vim(endtry):E602: :endtry without :try') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3356 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3357 " :endtry without :try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3358 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3359 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3360 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3361 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3362 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3363 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3364 call AssertException(['source Xtest'], 'Vim(endtry):E602: :endtry without :try') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3365 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3366 " Missing :endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3367 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3368 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3369 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3370 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3371 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3372 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3373 call AssertException(['source Xtest'], 'Vim(endtry):E171: Missing :endif') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3374 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3375 " Missing :endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3376 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3377 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3378 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3379 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3380 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3381 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3382 call AssertException(['source Xtest'], 'Vim(endtry):E170: Missing :endwhile') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3383 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3384 " Missing :endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3385 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3386 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3387 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3388 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3389 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3390 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3391 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3392 call AssertException(['source Xtest'], 'Vim(endtry):E171: Missing :endif') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3393 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3394 " Missing :endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3395 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3396 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3397 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3398 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3399 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3400 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3401 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3402 call AssertException(['source Xtest'], 'Vim(endtry):E170: Missing :endwhile') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3403 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3404 " Missing :endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3405 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3406 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3407 throw "a" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3408 catch /a/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3409 if 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3410 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3411 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3412 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3413 call AssertException(['source Xtest'], 'Vim(endtry):E171: Missing :endif') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3414 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3415 " Missing :endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3416 let code =<< trim END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3417 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3418 throw "a" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3419 catch /a/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3420 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3421 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3422 END |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3423 call writefile(code, 'Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3424 call AssertException(['source Xtest'], 'Vim(endtry):E170: Missing :endwhile') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3425 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3426 call delete('Xtest') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3427 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3428 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3429 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3430 " Test 57: v:exception and v:throwpoint for user exceptions {{{1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3431 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3432 " v:exception evaluates to the value of the exception that was caught |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3433 " most recently and is not finished. (A caught exception is finished |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3434 " when the next ":catch", ":finally", or ":endtry" is reached.) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3435 " v:throwpoint evaluates to the script/function name and line number |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3436 " where that exception has been thrown. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3437 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3438 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3439 func Test_user_exception_info() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3440 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3441 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3442 XpathINIT |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3443 XloopINIT |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3444 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3445 func FuncException() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3446 let g:exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3447 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3448 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3449 func FuncThrowpoint() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3450 let g:throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3451 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3452 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3453 let scriptException = MakeScript("FuncException") |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3454 let scriptThrowPoint = MakeScript("FuncThrowpoint") |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3455 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3456 command! CmdException let g:exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3457 command! CmdThrowpoint let g:throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3458 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3459 func T(arg, line) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3460 if a:line == 2 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3461 throw a:arg " in line 2 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3462 elseif a:line == 4 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3463 throw a:arg " in line 4 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3464 elseif a:line == 6 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3465 throw a:arg " in line 6 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3466 elseif a:line == 8 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3467 throw a:arg " in line 8 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3468 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3469 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3470 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3471 func G(arg, line) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3472 call T(a:arg, a:line) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3473 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3474 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3475 func F(arg, line) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3476 call G(a:arg, a:line) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3477 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3478 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3479 let scriptT = MakeScript("T") |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3480 let scriptG = MakeScript("G", scriptT) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3481 let scriptF = MakeScript("F", scriptG) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3482 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3483 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3484 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3485 call F("oops", 2) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3486 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3487 Xpath 'b' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3488 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3489 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3490 call assert_equal("oops", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3491 call assert_match('\<F\[1]\.\.G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3492 call assert_match('\<2\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3493 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3494 exec "let exception = v:exception" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3495 exec "let throwpoint = v:throwpoint" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3496 call assert_equal("oops", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3497 call assert_match('\<F\[1]\.\.G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3498 call assert_match('\<2\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3499 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3500 CmdException |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3501 CmdThrowpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3502 call assert_equal("oops", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3503 call assert_match('\<F\[1]\.\.G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3504 call assert_match('\<2\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3505 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3506 call FuncException() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3507 call FuncThrowpoint() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3508 call assert_equal("oops", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3509 call assert_match('\<F\[1]\.\.G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3510 call assert_match('\<2\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3511 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3512 exec "source" scriptException |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3513 exec "source" scriptThrowPoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3514 call assert_equal("oops", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3515 call assert_match('\<F\[1]\.\.G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3516 call assert_match('\<2\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3517 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3518 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3519 Xpath 'c' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3520 call G("arrgh", 4) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3521 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3522 Xpath 'd' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3523 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3524 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3525 call assert_equal("arrgh", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3526 call assert_match('\<G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3527 call assert_match('\<4\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3528 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3529 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3530 Xpath 'e' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3531 let g:arg = "autsch" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3532 let g:line = 6 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3533 exec "source" scriptF |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3534 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3535 Xpath 'f' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3536 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3537 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3538 call assert_equal("autsch", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3539 call assert_match(fnamemodify(scriptT, ':t'), v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3540 call assert_match('\<6\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3541 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3542 Xpath 'g' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3543 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3544 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3545 call assert_equal("arrgh", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3546 call assert_match('\<G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3547 call assert_match('\<4\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3548 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3549 Xpath 'h' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3550 let g:arg = "brrrr" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3551 let g:line = 8 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3552 exec "source" scriptG |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3553 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3554 Xpath 'i' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3555 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3556 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3557 " Resolve scriptT for matching it against v:throwpoint. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3558 call assert_equal("brrrr", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3559 call assert_match(fnamemodify(scriptT, ':t'), v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3560 call assert_match('\<8\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3561 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3562 Xpath 'j' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3563 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3564 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3565 call assert_equal("arrgh", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3566 call assert_match('\<G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3567 call assert_match('\<4\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3568 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3569 Xpath 'k' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3570 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3571 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3572 call assert_equal("arrgh", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3573 call assert_match('\<G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3574 call assert_match('\<4\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3575 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3576 Xpath 'l' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3577 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3578 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3579 call assert_equal("arrgh", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3580 call assert_match('\<G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3581 call assert_match('\<4\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3582 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3583 Xpath 'm' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3584 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3585 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3586 call assert_equal("oops", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3587 call assert_match('\<F\[1]\.\.G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3588 call assert_match('\<2\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3589 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3590 Xpath 'n' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3591 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3592 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3593 call assert_equal("oops", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3594 call assert_match('\<F\[1]\.\.G\[1]\.\.T\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3595 call assert_match('\<2\>', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3596 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3597 Xpath 'o' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3598 let exception = v:exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3599 let throwpoint = v:throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3600 call assert_equal("", v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3601 call assert_match('^$', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3602 call assert_match('^$', v:throwpoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3603 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3604 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3605 call assert_equal('abcdefghijklmno', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3606 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3607 unlet exception throwpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3608 delfunction FuncException |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3609 delfunction FuncThrowpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3610 call delete(scriptException) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3611 call delete(scriptThrowPoint) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3612 unlet scriptException scriptThrowPoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3613 delcommand CmdException |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3614 delcommand CmdThrowpoint |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3615 delfunction T |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3616 delfunction G |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3617 delfunction F |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3618 call delete(scriptT) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3619 call delete(scriptG) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3620 call delete(scriptF) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3621 unlet scriptT scriptG scriptF |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3622 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3623 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3624 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3625 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3626 " Test 58: v:exception and v:throwpoint for error/interrupt exceptions {{{1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3627 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3628 " v:exception and v:throwpoint work also for error and interrupt |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3629 " exceptions. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3630 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3631 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3632 func Test_execption_info_for_error() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3633 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3634 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3635 let test =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3636 func T(line) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3637 if a:line == 2 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3638 delfunction T " error (function in use) in line 2 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3639 elseif a:line == 4 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3640 call interrupt() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3641 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3642 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3643 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3644 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3645 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3646 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3647 call T(2) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3648 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3649 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3650 Xpath 'b' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3651 if v:exception !~ 'Vim(delfunction):' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3652 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3653 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3654 if v:throwpoint !~ '\<T\>' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3655 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3656 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3657 if v:throwpoint !~ '\<2\>' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3658 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3659 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3660 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3661 Xpath 'c' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3662 if v:exception != "" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3663 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3664 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3665 if v:throwpoint != "" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3666 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3667 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3668 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3669 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3670 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3671 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3672 Xpath 'd' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3673 if v:exception != "" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3674 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3675 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3676 if v:throwpoint != "" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3677 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3678 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3679 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3680 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3681 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3682 Xpath 'e' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3683 call T(4) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3684 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3685 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3686 Xpath 'f' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3687 if v:exception != 'Vim:Interrupt' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3688 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3689 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3690 if v:throwpoint !~ 'function T' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3691 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3692 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3693 if v:throwpoint !~ '\<4\>' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3694 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3695 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3696 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3697 Xpath 'g' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3698 if v:exception != "" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3699 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3700 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3701 if v:throwpoint != "" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3702 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3703 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3704 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3705 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3706 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3707 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3708 Xpath 'h' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3709 if v:exception != "" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3710 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3711 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3712 if v:throwpoint != "" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3713 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3714 endif |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3715 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3716 let verify =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3717 call assert_equal('abcdefgh', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3718 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3719 call RunInNewVim(test, verify) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3720 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3721 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3722 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3723 " Test 61: Catching interrupt exceptions {{{1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3724 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3725 " When an interrupt occurs inside a :try/:endtry region, an |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3726 " interrupt exception is thrown and can be caught. Its value is |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3727 " "Vim:Interrupt". If the interrupt occurs after an error or a :throw |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3728 " but before a matching :catch is reached, all following :catches of |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3729 " that try block are ignored, but the interrupt exception can be |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3730 " caught by the next surrounding try conditional. An interrupt is |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3731 " ignored when there is a previous interrupt that has not been caught |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3732 " or causes a :finally clause to be executed. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3733 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3734 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3735 func Test_catch_intr_exception() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3736 let test =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3737 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3738 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3739 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3740 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3741 call interrupt() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3742 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3743 catch /^Vim:Interrupt$/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3744 Xpath 'b' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3745 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3746 Xpath 'c' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3747 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3748 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3749 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3750 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3751 Xpath 'd' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3752 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3753 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3754 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3755 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3756 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3757 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3758 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3759 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3760 Xpath 'e' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3761 asdf |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3762 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3763 catch /do_not_catch/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3764 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3765 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3766 Xpath 'f' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3767 call interrupt() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3768 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3769 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3770 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3771 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3772 Xpath 'g' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3773 call interrupt() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3774 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3775 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3776 catch /^Vim:Interrupt$/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3777 Xpath 'h' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3778 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3779 Xpath 'i' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3780 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3781 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3782 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3783 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3784 Xpath 'j' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3785 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3786 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3787 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3788 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3789 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3790 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3791 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3792 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3793 Xpath 'k' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3794 throw "x" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3795 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3796 catch /do_not_catch/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3797 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3798 catch /x/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3799 Xpath 'l' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3800 call interrupt() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3801 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3802 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3803 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3804 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3805 catch /^Vim:Interrupt$/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3806 Xpath 'm' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3807 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3808 Xpath 'n' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3809 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3810 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3811 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3812 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3813 Xpath 'o' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3814 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3815 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3816 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3817 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3818 while 1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3819 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3820 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3821 Xpath 'p' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3822 call interrupt() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3823 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3824 catch /do_not_catch/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3825 call interrupt() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3826 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3827 catch /^Vim:Interrupt$/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3828 Xpath 'q' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3829 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3830 Xpath 'r' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3831 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3832 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3833 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3834 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3835 Xpath 's' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3836 break |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3837 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3838 endwhile |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3839 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3840 Xpath 't' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3841 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3842 let verify =<< trim [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3843 call assert_equal('abcdefghijklmnopqrst', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3844 [CODE] |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3845 call RunInNewVim(test, verify) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3846 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3847 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3848 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3849 " Test 65: Errors in the /pattern/ argument of a :catch {{{1 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3850 " |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3851 " On an error in the /pattern/ argument of a :catch, the :catch does |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3852 " not match. Any following :catches of the same :try/:endtry don't |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3853 " match either. Finally clauses are executed. |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3854 "------------------------------------------------------------------------------- |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3855 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3856 func Test_catch_pattern_error() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3857 CheckEnglish |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3858 XpathINIT |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3859 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3860 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3861 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3862 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3863 throw "oops" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3864 catch /^oops$/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3865 Xpath 'b' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3866 catch /\)/ " not checked; exception has already been caught |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3867 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3868 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3869 Xpath 'c' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3870 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3871 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3872 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3873 call assert_equal('abc', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3874 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3875 XpathINIT |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3876 func F() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3877 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3878 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3879 try |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3880 Xpath 'a' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3881 throw "ab" |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3882 catch /abc/ " does not catch |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3883 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3884 catch /\)/ " error; discards exception |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3885 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3886 catch /.*/ " not checked |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3887 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3888 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3889 Xpath 'b' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3890 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3891 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3892 catch /^ab$/ " checked, but original exception is discarded |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3893 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3894 catch /^Vim(catch):/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3895 Xpath 'c' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3896 call assert_match('Vim(catch):E475: Invalid argument:', v:exception) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3897 finally |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3898 Xpath 'd' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3899 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3900 Xpath 'e' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3901 catch /.*/ |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3902 call assert_report('should not get here') |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3903 endtry |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3904 Xpath 'f' |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3905 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3906 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3907 call F() |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3908 call assert_equal('abcdef', g:Xpath) |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3909 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3910 delfunc F |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3911 endfunc |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3912 |
97b887aecd4a
patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents:
21632
diff
changeset
|
3913 "------------------------------------------------------------------------------- |
18504
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3914 " 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
|
3915 " |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3916 " 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
|
3917 " 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
|
3918 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3919 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3920 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
|
3921 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
|
3922 endfu |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3923 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3924 func GetStr() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3925 return "abcdefghijklmnopqrstuvwxyp" |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3926 endfu |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3927 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3928 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
|
3929 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
|
3930 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3931 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
|
3932 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
|
3933 " 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
|
3934 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
|
3935 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
3936 |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3937 " 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
|
3938 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3939 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3940 func Test_curlies() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3941 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
|
3942 let ns = 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3943 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
|
3944 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3945 let g:a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3946 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
|
3947 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
|
3948 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
|
3949 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3950 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3951 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3952 " 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
|
3953 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3954 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3955 func Test_type() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3956 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
|
3957 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
|
3958 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
|
3959 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
|
3960 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
|
3961 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
|
3962 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
|
3963 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
|
3964 endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3965 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
|
3966 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
|
3967 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
|
3968 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
|
3969 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
|
3970 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
|
3971 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
|
3972 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
|
3973 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
|
3974 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
|
3975 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
|
3976 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
|
3977 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
|
3978 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
|
3979 endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3980 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
|
3981 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
|
3982 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
|
3983 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
|
3984 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
|
3985 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
|
3986 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
|
3987 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
|
3988 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
|
3989 if has('job') |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
3990 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
|
3991 endif |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
3992 if has('channel') |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
3993 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
|
3994 endif |
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
3995 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
|
3996 |
19548
9a9ca0e622c8
patch 8.2.0331: internal error when using test_void() and test_unknown()
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
3997 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
|
3998 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
|
3999 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4000 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
|
4001 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
|
4002 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
|
4003 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
|
4004 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4005 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
|
4006 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
|
4007 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
|
4008 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
|
4009 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4010 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
|
4011 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
|
4012 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
|
4013 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
|
4014 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
|
4015 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
|
4016 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4017 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
|
4018 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
|
4019 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
|
4020 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
|
4021 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4022 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
|
4023 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
|
4024 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
|
4025 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
|
4026 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4027 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
|
4028 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
|
4029 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
|
4030 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
|
4031 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4032 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
|
4033 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
|
4034 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
|
4035 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
|
4036 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
|
4037 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
|
4038 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4039 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
|
4040 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
|
4041 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
|
4042 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
|
4043 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
|
4044 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
|
4045 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4046 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
|
4047 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
|
4048 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
|
4049 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
|
4050 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4051 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
|
4052 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
|
4053 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
|
4054 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
|
4055 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4056 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
|
4057 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
|
4058 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
|
4059 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
|
4060 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4061 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
|
4062 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
|
4063 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
|
4064 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
|
4065 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4066 func ChangeYourMind() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4067 try |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4068 return v:true |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4069 finally |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4070 return 'something else' |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4071 endtry |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4072 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4073 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4074 call ChangeYourMind() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4075 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4076 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4077 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4078 " 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
|
4079 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4080 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4081 func Test_skip() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4082 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
|
4083 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
|
4084 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
|
4085 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
|
4086 let l = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4087 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
|
4088 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
|
4089 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
|
4090 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
|
4091 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
|
4092 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
|
4093 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
|
4094 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
|
4095 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
|
4096 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
|
4097 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
|
4098 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4099 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4100 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4101 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4102 " 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
|
4103 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4104 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4105 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
|
4106 " String |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4107 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
|
4108 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4109 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4110 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4111 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4112 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
|
4113 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
|
4114 \ "'foo bar'"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4115 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4116 " Float |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4117 if has('float') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4118 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
|
4119 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4120 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4121 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4122 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4123 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
|
4124 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
|
4125 \ "-1.2"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4126 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4127 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4128 " Funcref |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4129 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4130 echo function('string') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4131 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
|
4132 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4133 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
|
4134 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
|
4135 \ "function('string')"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4136 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4137 " Recursive dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4138 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4139 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
|
4140 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4141 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4142 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4143 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4144 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
|
4145 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
|
4146 \ "{'a': {...}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4147 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4148 " Recursive list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4149 let a = [0] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4150 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
|
4151 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4152 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4153 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4154 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4155 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
|
4156 call assert_equal(["[[...]]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4157 \ "[[...]]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4158 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4159 " 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
|
4160 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4161 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4162 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
|
4163 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
|
4164 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4165 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
|
4166 call assert_equal(["[{}, {}, {}]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4167 \ "[{}, {}, {}]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4168 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4169 " 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
|
4170 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4171 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
|
4172 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4173 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4174 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4175 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4176 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
|
4177 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
|
4178 \ "{'a': {}, 'b': {}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4179 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4180 " 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
|
4181 let a = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4182 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4183 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
|
4184 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
|
4185 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4186 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
|
4187 call assert_equal(["[[], [], []]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4188 \ "[[], [], []]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4189 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4190 " 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
|
4191 let a = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4192 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
|
4193 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4194 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4195 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4196 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4197 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
|
4198 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
|
4199 \ "{'a': [], 'b': []}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4200 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4201 " 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
|
4202 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
|
4203 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4204 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
|
4205 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
|
4206 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4207 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
|
4208 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
|
4209 \ "[{'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
|
4210 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4211 " 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
|
4212 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
|
4213 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
|
4214 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4215 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4216 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4217 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4218 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
|
4219 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
|
4220 \ "{'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
|
4221 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4222 " 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
|
4223 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
|
4224 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4225 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
|
4226 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
|
4227 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4228 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
|
4229 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
|
4230 \ "[[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
|
4231 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4232 " 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
|
4233 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
|
4234 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
|
4235 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4236 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4237 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4238 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4239 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
|
4240 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
|
4241 \ "{'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
|
4242 |
19991
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
4243 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
|
4244 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
|
4245 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
|
4246 |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4247 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4248 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4249 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4250 " 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
|
4251 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4252 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4253 func Test_num64() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4254 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
|
4255 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
|
4256 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
|
4257 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
|
4258 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4259 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
|
4260 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
|
4261 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
|
4262 |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
4263 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
|
4264 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
|
4265 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
|
4266 endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4267 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4268 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
|
4269 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
|
4270 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
|
4271 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
|
4272 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
|
4273 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4274 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4275 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4276 " 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
|
4277 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4278 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4279 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
|
4280 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
|
4281 exec func |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4282 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4283 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4284 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
|
4285 " :append |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4286 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4287 call DefineFunction('T_Append', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4288 \ 'append', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4289 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4290 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4291 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4292 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4293 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
|
4294 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4295 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4296 call DefineFunction('T_Append', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4297 \ 'append', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4298 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4299 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4300 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
|
4301 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4302 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
|
4303 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4304 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4305 " :change |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4306 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4307 call DefineFunction('T_Change', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4308 \ 'change', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4309 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4310 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4311 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4312 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4313 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
|
4314 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4315 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4316 call DefineFunction('T_Change', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4317 \ 'change', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4318 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4319 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4320 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
|
4321 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4322 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
|
4323 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4324 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4325 " :insert |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4326 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4327 call DefineFunction('T_Insert', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4328 \ 'insert', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4329 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4330 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4331 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4332 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4333 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
|
4334 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4335 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4336 call DefineFunction('T_Insert', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4337 \ 'insert', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4338 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4339 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4340 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
|
4341 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4342 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
|
4343 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4344 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4345 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4346 "------------------------------------------------------------------------------- |
11352
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
4347 " 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
|
4348 " |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
4349 " 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
|
4350 " 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
|
4351 "------------------------------------------------------------------------------- |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
4352 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
|
4353 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
4354 \ |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
4355 endfunc |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
4356 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
4357 "------------------------------------------------------------------------------- |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4358 " Test 97: bitwise functions {{{1 |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4359 "------------------------------------------------------------------------------- |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4360 func Test_bitwise_functions() |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4361 " and |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4362 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
|
4363 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
|
4364 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
|
4365 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
|
4366 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
|
4367 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
|
4368 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
|
4369 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
|
4370 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
|
4371 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4372 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
|
4373 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
|
4374 " or |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4375 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
|
4376 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
|
4377 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
|
4378 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
|
4379 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
|
4380 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
|
4381 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
|
4382 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
|
4383 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
|
4384 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4385 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
|
4386 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
|
4387 " xor |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4388 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
|
4389 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
|
4390 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
|
4391 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
|
4392 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
|
4393 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
|
4394 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
|
4395 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4396 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
|
4397 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
|
4398 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
|
4399 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
|
4400 " invert |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4401 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
|
4402 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
|
4403 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
|
4404 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
|
4405 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
|
4406 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
|
4407 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4408 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
|
4409 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
|
4410 endfunc |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4411 |
11547
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
4412 " 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
|
4413 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
|
4414 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
|
4415 Ni! |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
4416 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
|
4417 unlet nieuw |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
4418 delcommand Nieuw |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
4419 endfunc |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
4420 |
19035
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4421 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
|
4422 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
|
4423 func s:snr() |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4424 return expand('<sfile>') |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4425 endfunc |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4426 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
|
4427 END |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4428 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
|
4429 source Xexpand |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4430 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
|
4431 source Xexpand |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4432 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
|
4433 |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4434 call delete('Xexpand') |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4435 unlet g:result |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4436 endfunc |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
4437 |
15790
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4438 func Test_compound_assignment_operators() |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4439 " Test for number |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4440 let x = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4441 let x += 10 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4442 call assert_equal(11, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4443 let x -= 5 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4444 call assert_equal(6, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4445 let x *= 4 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4446 call assert_equal(24, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4447 let x /= 3 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4448 call assert_equal(8, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4449 let x %= 3 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4450 call assert_equal(2, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4451 let x .= 'n' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4452 call assert_equal('2n', x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4453 |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4454 " 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
|
4455 let x = 1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4456 let x /= 0 |
19427
fdfe44ac6a1a
patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
4457 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
|
4458 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4459 let x = -1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4460 let x /= 0 |
19427
fdfe44ac6a1a
patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
4461 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
|
4462 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4463 let x = 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4464 let x /= 0 |
19427
fdfe44ac6a1a
patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
4465 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
|
4466 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4467 let x = 1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4468 let x %= 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4469 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
|
4470 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4471 let x = -1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4472 let x %= 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4473 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
|
4474 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4475 let x = 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4476 let x %= 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
4477 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
|
4478 |
15790
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4479 " Test for string |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4480 let x = 'str' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4481 let x .= 'ing' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4482 call assert_equal('string', x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4483 let x += 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4484 call assert_equal(1, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4485 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4486 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
|
4487 " 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
|
4488 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
|
4489 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
|
4490 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
|
4491 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
|
4492 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
|
4493 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
|
4494 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
|
4495 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
|
4496 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
|
4497 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
|
4498 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
|
4499 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
|
4500 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
|
4501 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
|
4502 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
|
4503 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
4504 " 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
|
4505 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
|
4506 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
|
4507 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
|
4508 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
|
4509 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
|
4510 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
|
4511 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
|
4512 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
|
4513 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
|
4514 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
|
4515 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
|
4516 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
|
4517 endif |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4518 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4519 " Test for environment variable |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4520 let $FOO = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4521 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
|
4522 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
|
4523 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
|
4524 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
|
4525 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
|
4526 let $FOO .= 's' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4527 call assert_equal('1s', $FOO) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4528 unlet $FOO |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4529 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4530 " 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
|
4531 let &scrolljump = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4532 let &scrolljump += 5 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4533 call assert_equal(6, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4534 let &scrolljump -= 2 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4535 call assert_equal(4, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4536 let &scrolljump *= 3 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4537 call assert_equal(12, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4538 let &scrolljump /= 2 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4539 call assert_equal(6, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4540 let &scrolljump %= 5 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4541 call assert_equal(1, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4542 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
|
4543 set scrolljump&vim |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4544 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4545 " Test for register |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4546 let @/ = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4547 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
|
4548 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
|
4549 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
|
4550 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
|
4551 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
|
4552 let @/ .= 's' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4553 call assert_equal('1s', @/) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4554 let @/ = '' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4555 endfunc |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4556 |
20093
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
4557 func Test_unlet_env() |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
4558 let $TESTVAR = 'yes' |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
4559 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
|
4560 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
|
4561 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
|
4562 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
|
4563 if 0 |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
4564 unlet $TESTVAR |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
4565 endif |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
4566 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
|
4567 unlet $TESTVAR |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
4568 call assert_equal('', $TESTVAR) |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
4569 endfunc |
646c53fa5781
patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
4570 |
16078
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4571 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
|
4572 " 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
|
4573 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
|
4574 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
|
4575 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
|
4576 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
|
4577 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
|
4578 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
|
4579 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
|
4580 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
|
4581 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
|
4582 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4583 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
|
4584 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
|
4585 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4586 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4587 " 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
|
4588 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
|
4589 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
|
4590 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
|
4591 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
|
4592 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
|
4593 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
|
4594 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
|
4595 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
|
4596 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
|
4597 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4598 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4599 " 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
|
4600 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
|
4601 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
|
4602 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4603 let x = {} |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
4604 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
|
4605 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4606 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
|
4607 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
|
4608 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4609 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
|
4610 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
|
4611 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
|
4612 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
|
4613 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4614 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
|
4615 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
|
4616 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
|
4617 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
|
4618 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
|
4619 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4620 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4621 " 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
|
4622 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
|
4623 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
|
4624 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
|
4625 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
|
4626 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
|
4627 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
|
4628 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
|
4629 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
|
4630 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4631 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
|
4632 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
|
4633 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
|
4634 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
|
4635 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
|
4636 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
|
4637 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
|
4638 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
|
4639 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4640 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
|
4641 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4642 " 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
|
4643 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
|
4644 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
|
4645 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
|
4646 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4647 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
|
4648 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
|
4649 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
|
4650 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
|
4651 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
|
4652 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
|
4653 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
|
4654 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
|
4655 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
|
4656 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
|
4657 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
|
4658 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
|
4659 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
|
4660 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
|
4661 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
|
4662 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
|
4663 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
|
4664 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
|
4665 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
|
4666 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
|
4667 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4668 " 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
|
4669 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
|
4670 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
|
4671 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4672 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
|
4673 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
|
4674 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
|
4675 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
|
4676 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
|
4677 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
|
4678 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
4679 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4680 " 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
|
4681 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
|
4682 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
|
4683 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
|
4684 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
|
4685 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
|
4686 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
|
4687 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
|
4688 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
|
4689 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
|
4690 call delete('Xscript') |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4691 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4692 " Using endfor with :while |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4693 let caught_e732 = 0 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4694 try |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4695 while v:true |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4696 endfor |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4697 catch /E732:/ |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4698 let caught_e732 = 1 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4699 endtry |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4700 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
|
4701 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4702 " Using endwhile with :for |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4703 let caught_e733 = 0 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4704 try |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4705 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
|
4706 endwhile |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4707 catch /E733:/ |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4708 let caught_e733 = 1 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4709 endtry |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4710 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
|
4711 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4712 " Using endfunc with :if |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4713 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
|
4714 |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
4715 " 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
|
4716 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
|
4717 |
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
4718 " 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
|
4719 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
|
4720 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4721 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4722 " 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
|
4723 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
|
4724 CheckRunVimInTerminal |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4725 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4726 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
|
4727 " 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
|
4728 func Test1() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4729 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
|
4730 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
|
4731 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
|
4732 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4733 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4734 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4735 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4736 " 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
|
4737 func Test2() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4738 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
|
4739 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
|
4740 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
|
4741 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4742 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4743 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4744 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4745 " 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
|
4746 func Test3() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4747 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
|
4748 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
|
4749 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
|
4750 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4751 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4752 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4753 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4754 " 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
|
4755 func Test4() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4756 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
|
4757 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
|
4758 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
|
4759 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4760 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4761 endfunc |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4762 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4763 " 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
|
4764 func Test5() |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4765 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
|
4766 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
|
4767 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
|
4768 @a |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4769 let @a = '' |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4770 endfunc |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4771 [SCRIPT] |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4772 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
|
4773 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4774 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
|
4775 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4776 " 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
|
4777 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
|
4778 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
|
4779 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
|
4780 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4781 " 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
|
4782 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
|
4783 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
|
4784 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
|
4785 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4786 " 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
|
4787 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
|
4788 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
|
4789 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
|
4790 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4791 " 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
|
4792 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
|
4793 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
|
4794 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
|
4795 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4796 " 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
|
4797 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
|
4798 call TermWait(buf) |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4799 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
|
4800 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
|
4801 call TermWait(buf) |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
4802 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4803 "let l = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4804 "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
|
4805 " 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
|
4806 "endfor |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4807 "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
|
4808 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4809 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
|
4810 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
|
4811 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
4812 |
19724
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
4813 " 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
|
4814 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
|
4815 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
|
4816 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
|
4817 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
|
4818 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
|
4819 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
|
4820 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
|
4821 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
|
4822 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
|
4823 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
|
4824 endif |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
4825 endfunc |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
4826 |
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
|
4827 " 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
|
4828 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
|
4829 " 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
|
4830 let caught_e128 = 0 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4831 try |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4832 func! g:test() |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4833 echo "test" |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4834 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4835 catch /E128:/ |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4836 let caught_e128 = 1 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4837 endtry |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4838 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
|
4839 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4840 " 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
|
4841 let caught_e884 = 0 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4842 try |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4843 func! b:test() |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4844 echo "test" |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4845 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4846 catch /E884:/ |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4847 let caught_e884 = 1 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4848 endtry |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4849 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
|
4850 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4851 " function name folowed by # |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4852 let caught_e128 = 0 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4853 try |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4854 func! test2() "# |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4855 echo "test2" |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4856 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4857 catch /E128:/ |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4858 let caught_e128 = 1 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4859 endtry |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4860 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
|
4861 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4862 " 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
|
4863 function! g:Foo(n) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4864 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
|
4865 endfunction |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4866 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
|
4867 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
|
4868 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
|
4869 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
|
4870 delfunc g:Foo |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4871 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4872 " 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
|
4873 let lines =<< trim END |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4874 func s:Testje() |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4875 return "foo" |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4876 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4877 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
|
4878 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
|
4879 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
|
4880 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
|
4881 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
|
4882 END |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4883 call writefile(lines, 'Xscript') |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4884 source Xscript |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4885 call delete('Xscript') |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4886 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4887 |
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
|
4888 " 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
|
4889 func Test_substring_var() |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4890 let str = 'abcdef' |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4891 let n = 3 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4892 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
|
4893 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
|
4894 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
|
4895 unlet n |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4896 let nn = 3 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4897 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
|
4898 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
|
4899 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
|
4900 unlet nn |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4901 let b:nn = 4 |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4902 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
|
4903 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
|
4904 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
|
4905 unlet b:nn |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4906 endfunc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20093
diff
changeset
|
4907 |
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
|
4908 " 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
|
4909 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
|
4910 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
|
4911 |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
4912 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
|
4913 |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
4914 " 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
|
4915 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
|
4916 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
|
4917 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
|
4918 |
8fb0e507491d
patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
4919 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
|
4920 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
|
4921 |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
4922 "------------------------------------------------------------------------------- |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4923 " Modelines {{{1 |
18504
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
4924 " 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
|
4925 "------------------------------------------------------------------------------- |