annotate src/testdir/test_vimscript.vim @ 27287:9f72ec92d361 v8.2.4172

patch 8.2.4172: filetype detection for BASIC is not optimal Commit: https://github.com/vim/vim/commit/6517f14165cdebf83a07ab9d4aeeb102b4e16e92 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 21 14:55:13 2022 +0000 patch 8.2.4172: filetype detection for BASIC is not optimal Problem: Filetype detection for BASIC is not optimal. Solution: Improve BASIC filetype detection. (Doug Kearns)
author Bram Moolenaar <Bram@vim.org>
date Fri, 21 Jan 2022 16:00:05 +0100
parents c40554dfe03e
children dd7d94b911fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
2 " Most of this was formerly in test49.vim (developed by Servatius Brandt
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
3 " <Servatius.Brandt@fujitsu-siemens.com>)
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17251
diff changeset
5 source check.vim
17698
131f1d8c5860 patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
6 source shared.vim
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
7 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
8
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " Test environment {{{1
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
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 " 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
14 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
15 split messages
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 $put =a:text
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 wq
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 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
21
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
22 " 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
23 " 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
24 " 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
25 func RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
26 let init =<< trim END
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
27 set cpo-=C " support line-continuation in sourced script
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
28 source script_util.vim
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
29 XpathINIT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
30 XloopINIT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
31 END
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
32 let cleanup =<< trim END
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
33 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
34 qall
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
35 END
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
36 call writefile(init, 'Xtest.vim')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
37 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
38 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
39 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
40 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
41 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
42 call delete('Xtest.out')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
43 call delete('Xtest.vim')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
44 call delete('Xverify.vim')
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
45 endfunc
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
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 " 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
49 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 " 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
51 " :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
52 " 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
53 " tests will hang.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
56 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
57 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 let first = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 if first
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 let first = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 return
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 endwhile
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
70 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
71
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
72 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
73 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 let first = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 if first
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 let first = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 return
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 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
86 endwhile
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
87 endfunc
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 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
90 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 call T1_F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 Xpath 'F'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 try
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 call T1_G()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 catch
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 " Catch missing :endif
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
98 call assert_true(v:exception =~ 'E171:')
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 Xpath 'x'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 Xpath 'G'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 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
104 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105
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 " 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
108 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 " 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
110 " :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
111 " 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
112 " on an error.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 " 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
115 " 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
116 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 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
119 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 ExecAsScript T1_F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 Xpath 'F'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call DeleteTheScript()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 try
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 ExecAsScript T1_G
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 catch
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 " Catch missing :endif
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
128 call assert_true(v:exception =~ 'E171:')
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 Xpath 'x'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 Xpath 'G'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 call DeleteTheScript()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 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
135 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136
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 " 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
139 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
141 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
142 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 let loops = 3
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 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
147 if loops <= 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 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
149 let loops = -1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 Xpath 'b' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 if (loops == 2)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 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
155 Xpath 'c' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 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
157 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
158 Xpath 'd' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 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
161 Xpath 'e' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 elseif (loops == 1)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 let p = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 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
165 Xpath 'f' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 let p = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 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
168 Xpath 'g' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 Xpath 'h' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 unlet p
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 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
173 Xpath 'i' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 if (loops > 0)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 Xpath 'j' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 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
179 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
180 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
181 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
182 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 endif
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 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
188 Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 unlet break_err
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 endif
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 unlet loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 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
195 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196
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 " 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
199 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
201 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
202 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 let loops = 3
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 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
206 Xpath 'b' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 if (loops == 2)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 Xpath 'c' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 return
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 Xpath 'd' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 Xpath 'e' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 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
214 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 endif
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
219 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
220
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
221 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
222 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 call T4_F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 Xpath '4'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 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
227 endfunc
10942
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
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 " 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
232 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 " 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
234 " 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
235 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
237 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
238 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 ExecAsScript T4_F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 Xpath '5'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 call DeleteTheScript()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 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
244 endfunc
10942
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
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 " 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
250 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 " 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
252 " 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
253 " 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
254 " 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
255 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 " 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
257 " 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
258 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 " 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
263 " 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
264 " 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
265 " 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
266 " 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
267 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268 let calls = ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 com! -nargs=1 CALL
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
270 \ if !exists("calls") && !exists("outer") |
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
271 \ 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
272 \ endif
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
273
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 let i = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 while i < 3
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 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
277 if i == 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 function! F1(arg)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 CALL a:arg
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 let outer = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 let j = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
284 while j < 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 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
287 function! G1(arg)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 CALL a:arg
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 continue
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 Xpath 'e' . i
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299 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
300 CALL a:arg
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301 let outer = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303 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
304 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
306 let k = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
307 while k < 3
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 Xpath 'g' . k
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 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
310 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
311 CALL a:arg
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
312 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313 Xpath 'h' . k
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
316 Xpath 'i'
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 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
319
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
320 if exists("*G1")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
321 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
322 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
323 if exists("*F1")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
324 call F1("F1")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
325 if exists("*G1")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
326 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
327 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
328 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
330 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
331 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
332 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
333 if exists("*F2")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
334 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
335 if exists("*G21")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
336 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
337 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
338 if exists("*G22")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
339 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
340 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
341 if exists("*G23")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
342 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
343 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
344 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
345
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
346 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
347 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
348 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
349 if exists("*F3")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 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
351 if exists("*G31")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
352 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
353 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 if exists("*G32")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
355 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
356 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
357 if exists("*G33")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
358 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
359 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
360 endif
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 Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
363
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
364 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
365 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
366
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
367 unlet calls
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
368 delfunction F1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 delfunction G1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 delfunction F2
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
371 delfunction G21
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
372 delfunction G22
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
373 delfunction G23
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
374 delfunction G31
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
375 delfunction G32
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
376 delfunction G33
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
377
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
378 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
379 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
380 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
381 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
382
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 " 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
385 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
386 " 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
387 " 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
388 " 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
389 " line.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
390 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
393
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
394 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
395 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
396 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
401 endwhile | Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
402 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403 endif | Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
405
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
406 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
407 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
408 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
409 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
410 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
411 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
412 endif | Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
413 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
415 endwhile | Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
416 Xpath 'n'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
417
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
418 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
419 Xpath 'o'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
420
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
421 asdf | Xpath 'p'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
422 Xpath 'q'
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 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
425
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
426 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
427 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
428 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
429
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 " 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
432 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
433 " 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
434 " 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
435 " 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
436 " "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
437 " 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
438 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
439
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
440 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
441
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
442 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
443 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
444 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
445 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
446 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
447 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
448 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
449 asdf | Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
450 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
451 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
452 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
453 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
454 endif | Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
455 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
456
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
457 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
458 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
459 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
460 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
461 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
462 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
463 asdf | Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
464 Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
465 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
466 Xpath 'n'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
467 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
468 endwhile | Xpath 'o'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
469 Xpath 'p'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
470
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
471 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
472 Xpath 'q'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
473 return 1 " not reached
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
474 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
475
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
476 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
477 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
478 Xpath 'r'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
479 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
480 Xpath 's'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
481 asdf " returns -1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
482 Xpath 't'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
484 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
485 Xpath 'v'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
486 endif | Xpath 'w'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
487 Xpath 'x'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
488
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
489 return -4 " not reached
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
490 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
491
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
492 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
493 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
494 Xpath 'A'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
495 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
496 Xpath 'B'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497 asdf " returns -1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498 Xpath 'C'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
500 Xpath 'D'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
501 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
502 endwhile | Xpath 'E'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
503 Xpath 'F'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
504
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505 return -4 " not reached
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
506 endfunc
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
507
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
508 " 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
509 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
510 Xpath 'X'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
511 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
512
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
513 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
514 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
515 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
516
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
517 delfunction T8_F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
518 delfunction T8_G
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
519 delfunction T8_H
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
520 endfunc
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
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 " 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
525 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
526 " 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
527 " 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
528 " "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
529 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
530
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
531 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
533 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
534 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
535 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
536 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
537 if result != 2
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
538 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
540 return 1
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
541 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
542
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
543 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
544 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
545 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
546 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
547 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
548 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
549 return 2
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
550 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
551
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
552 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
553 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
554 call I() " aborted
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
555 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556 return 4
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
557 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
558
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
559 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
560 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
561 asdf " error
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
562 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
563 return 8
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
564 endfunc
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
565
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
566 if F() != 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
567 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
568 endif
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 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
571
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
572 delfunction F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
573 delfunction G
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
574 delfunction H
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
575 delfunction I
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
576
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
577 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
578 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
579 endfunc
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
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 " 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
584 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
585 " 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
586 " 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
587 " be recognized.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
588 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
589
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
590 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
591
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
592 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
593 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
594 if a:enr == ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
595 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
596 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
597 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
598 let match = 1
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 !~ '^'.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
600 let match = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
601 if v:errmsg == ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
602 Xout "Message missing."
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
603 else
17849
73ddc462979d patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17783
diff changeset
604 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
605 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
606 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
607 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
608 return match
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
609 endfunc
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
610
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
611 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
612 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
613 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
614 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
615
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
616 if 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
617 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
618 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
619 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
620 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
621
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
622 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
623 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
624 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
625 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
626 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
627
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
628 let v:errmsg = ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
629 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
630 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
631 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
632 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
633 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
634 Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
635 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
636
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
637 let v:errmsg = ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
638 if 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
639 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
640 Xpath 'o'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
641 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
642 Xpath 'p'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
643 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
644 Xpath 'q'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
645 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
646
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
647 let v:errmsg = ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
648 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
649 Xpath 's'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
650 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
651 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
652 Xpath 't'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
653 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
654 Xpath 'u'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
655 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
656
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
657 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
658 delfunction MSG
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
659
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
660 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
661 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
662 endfunc
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
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 " 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
667 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
668 " 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
669 " 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
670 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
673
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
674 let calls = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
675
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
676 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
677 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
678 return 0
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
679 endfunc
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
680
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
681 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
682 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
683 asdf " error
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
684 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
685 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
686 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
687 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
688 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
689 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
690 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
691 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
692 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
693 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
694 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
695 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
696 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
697 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
698 Xpath 'x'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
699
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
700 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
701 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
702
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
703 unlet calls
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
704 delfunction P
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
705
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
706 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
707 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
708 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
709 endfunc
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
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 " 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
714 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
715 " 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
716 " 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
717 " 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
718 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
721
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
722 function! NULL()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
723 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
724 return 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
725 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
726
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
727 function! ZERO()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
728 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
729 return 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
730 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
731
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
732 function! F0()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
733 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
734 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
735
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
736 function! F1(arg)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
737 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
738 endfunction
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 let V0 = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
741
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
742 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
743 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
744
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
745 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
746 if 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
747 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
748 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
749 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
750
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
751 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
752 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
753 asdf " error
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
754 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
755 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
756 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
757
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
758 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
759 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
760 asdf " error
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
761 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
762 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
763 endif
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 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
766
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
767 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
768 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
769 endfunc
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
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 " 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
774 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
775 " 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
776 " 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
777 " 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
778 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
781
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
782 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
783 while asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
784 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
785 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
786 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
787 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
788 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
789 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
790 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
791 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
792 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
793
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
794 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
795 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
796 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
797
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
798 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
799 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
800 endfunc
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
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 " 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
805 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
806 " 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
807 " 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
808 " 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
809 " are executed.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
810 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
813
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
814 function! F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
815 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
816 let x = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
817 if x " false
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
818 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
819 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
820 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
821 let x = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
822 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
823 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
824 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
825 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
826 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
827 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
828 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
829 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
830 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
831 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
832 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
833
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
834 let boolvar = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
835 call F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
836 Xpath '-'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
837
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
838 unlet boolvar
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
839 call F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
840 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
841
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
842 delfunction F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
843
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
844 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
845 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
846 endfunc
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
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 " 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
851 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
852 " 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
853 " 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
854 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
857
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
858 function! F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
859 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
860 let x = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
861 if x " false
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
862 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
863 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
864 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
865 let x = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
866 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
867 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
868 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
869 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
870 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
871 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
872 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
873
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
874 let boolvar = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
875 call F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
876 Xpath '-'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
877
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
878 unlet boolvar
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
879 call F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
880 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
881
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
882 delfunction F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
883
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
884 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
885 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
886 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
887
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
888 "-------------------------------------------------------------------------------
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
889 " 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
890 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
891 " 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
892 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
893
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
894 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
895 if 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
896 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
897 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
898 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
899 else " aborts function
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
900 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
901 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
902 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
903 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
904
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
905 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
906 if 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
907 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
908 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
909 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
910 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
911 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
912 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
913 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
914 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
915 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
916 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
917
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
918 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
919 if 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
920 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
921 elseif 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
922 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
923 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
924 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
925 else " aborts function
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
926 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
927 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
928 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
929 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
930
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
931 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
932 if 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
933 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
934 elseif 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
935 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
936 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
937 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
938 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
939 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
940 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
941 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
942 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
943 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
944 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
945
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
946 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
947 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
948 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
949 call T16_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
950 catch /E583:/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
951 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
952 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
953 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
954
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
955 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
956 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
957 call T16_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
958 catch /E584:/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
959 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
960 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
961 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
962
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
963 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
964 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
965 call T16_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
966 catch /E583:/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
967 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
968 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
969 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
970
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
971 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
972 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
973 call T16_I()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
974 catch /E584:/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
975 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
976 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
977 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
978 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
979
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 " 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
982 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
983 " 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
984 " :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
985 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
986
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
987 " 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
988 func T17_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
989 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
990 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
991 let 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 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
993 if (loops == 1)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
994 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
995 continue
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
996 elseif (loops == 0)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
997 Xpath 'c' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
998 break
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
999 elseif 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1000 Xpath 'd' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1001 " endif missing!
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1002 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
1003 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1004 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1005
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1006 func T17_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1007 let loops = 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1008 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1009 let loops -= 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1010 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1011 if 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1012 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1013 " endif missing
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1014 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
1015 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1016
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1017 func T17_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1018 let loops = 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1019 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1020 let loops -= 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1021 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1022 " if missing!
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1023 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
1024 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1025 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1026 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1027
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1028 " 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
1029 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1030 let v:errmsg = ''
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1031 let loops = 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1032 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1033 let loops -= 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1034 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1035 if 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1036 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1037 " 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
1038 endwhile | Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1039 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1040 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
1041 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
1042
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1043 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
1044 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1045 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
1046 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
1047
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1048 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1049 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
1050 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
1051
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1052 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1053 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
1054 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
1055 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1056
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
1057 "-------------------------------------------------------------------------------
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1058 " 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
1059 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1060 " 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
1061 "-------------------------------------------------------------------------------
21632
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1062
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1063 func Test_interrupt_while_if()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1064 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1065 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1066 if 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1067 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1068 while 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1069 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1070 if 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1071 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1072 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1073 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1074 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1075 finish
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1076 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
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 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
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 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
1081 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1082 catch /^Vim:Interrupt$/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1083 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1084 endtry | Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1085 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1086 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1087 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1088 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
1089 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1090 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1091 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1092
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1093 func Test_interrupt_try()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1094 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1095 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1096 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1097 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1098 call interrupt()
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 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
1101 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1102 catch /^Vim:Interrupt$/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1103 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1104 endtry | Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1105 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1106 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1107 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1108 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
1109 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1110 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1111 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1112
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1113 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
1114 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1115 func F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1116 if 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1117 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1118 while 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1119 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1120 if 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1121 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1122 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1123 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1124 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1125 return
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1126 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
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 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
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 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
1131 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1132 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1133
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1134 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1135 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1136 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
1137 catch /^Vim:Interrupt$/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1138 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1139 endtry | Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1140 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1141 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1142 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1143 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
1144 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1145 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1146 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1147
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1148 func Test_interrupt_func_try()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1149 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1150 func G()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1151 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1152 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1153 call interrupt()
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 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
1156 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1157 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1158
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1159 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1160 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1161 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
1162 catch /^Vim:Interrupt$/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1163 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1164 endtry | Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1165 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1166 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1167 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1168 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
1169 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1170 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1171 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1172
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 " 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
1175 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1176 " 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
1177 " 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
1178 " 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
1179 " function has an "abort" attribute.
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1180 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1181
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1182 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
1183 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1184 func F() abort
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1185 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1186 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1187 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1188 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1189
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1190 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1191 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1192 call F()
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 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
1195 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1196 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1197 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1198 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
1199 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1200 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1201 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1202
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1203 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
1204 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1205 func G()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1206 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1207 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1208 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1209 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1210
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1211 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1212 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1213 call G()
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 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
1216 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1217 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1218 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1219 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
1220 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1221 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1222 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1223
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1224 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
1225 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1226 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1227 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1228 asdf
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 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
1231 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1232 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1233 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1234 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
1235 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1236 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1237 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1238
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1239 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
1240 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1241 if 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1242 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1243 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1244 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1245 call assert_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 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
1247 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
1248 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1249 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1250 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1251 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
1252 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1253 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1254 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1255
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1256 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
1257 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1258 let p = 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1259 while p
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1260 let p = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1261 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1262 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1263 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1264 call assert_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 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
1266 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
1267 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1268 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1269 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1270 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
1271 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1272 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1273 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1274
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1275 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
1276 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1277 let p = 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1278 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1279 while p
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1280 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1281 let p = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1282 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1283 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1284 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
1285 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1286 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1287 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1288 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
1289 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1290 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1291 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1292
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 " 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
1295 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1296 " 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
1297 " 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
1298 " seen.
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1299 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1300
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1301 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
1302 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1303 let p = 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1304 while p
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1305 let p = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1306 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1307 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1308 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1309 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1310 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1311 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1312 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
1313 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1314 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1315 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1316 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
1317 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1318 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1319 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1320
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1321 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
1322 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1323 while 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1324 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1325 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1326 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1327 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1328 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1329 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1330 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1331 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1332 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1333 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1334 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1335 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
1336 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1337 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1338 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1339
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1340 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
1341 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1342 while 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1343 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1344 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1345 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1346 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1347 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1348 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1349 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1350 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1351 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1352 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1353 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1354 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1355 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1356 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
1357 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1358 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1359 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1360
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1361 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
1362 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1363 while 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1364 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1365 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1366 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1367 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1368 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1369 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1370 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1371 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1372 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1373 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1374 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1375 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1376 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1377 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
1378 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1379 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1380 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1381
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1382 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
1383 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1384 let p = 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1385 while p
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1386 let p = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1387 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1388 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1389 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1390 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1391 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1392 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1393 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1394 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1395 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1396 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1397 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1398 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
1399 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1400 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1401 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1402
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1403 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
1404 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1405 let p = 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1406 while p
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1407 let p = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1408 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1409 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1410 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1411 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1412 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1413 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1414 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1415 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1416 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1417 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1418 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1419 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1420 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1421 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
1422 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1423 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1424 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1425
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1426 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
1427 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1428 let p = 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1429 while p
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1430 let p = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1431 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1432 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1433 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1434 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1435 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1436 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1437 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1438 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1439 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1440 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1441 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1442 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1443 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1444 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
1445 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1446 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1447 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1448
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 " 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
1451 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1452 " 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
1453 " :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
1454 " executed.
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1455 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1456
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1457 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
1458 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1459 func F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1460 let loops = 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1461 while loops > 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1462 XloopNEXT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1463 let loops = loops - 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1464 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1465 if loops == 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1466 Xloop 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1467 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1468 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1469 elseif loops == 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1470 Xloop 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1471 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1472 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1473 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1474
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1475 try " inactive
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 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1478 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1479 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1480 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1481 Xloop 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1482 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1483 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1484 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1485
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1486 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1487 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1488 return
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 try " inactive
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 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1493 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1494 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1495 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1496 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1497 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1498 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1499 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1500
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1501 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1502 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1503 call F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1504 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1505 finish
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 try " inactive
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 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1510 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1511 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1512 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1513 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1514 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1515 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1516 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1517 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1518 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
1519 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1520 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1521 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1522
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 " 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
1525 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1526 " 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
1527 " 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
1528 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1529
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1530 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
1531 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1532 func Error()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1533 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1534 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1535 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
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1538 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1539 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1540
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1541 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1542 call Error()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1543 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1544
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1545 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
1546 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
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 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1549 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1550 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1551 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1552
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1553 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
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 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1556 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1557 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1558 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1559 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1560 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
1561 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1562 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1563 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1564
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1565 func Test_finally_after_interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1566 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1567 func Interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1568 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1569 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1570 call interrupt() " triggering interrupt exception
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1571 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1572 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1573 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1574
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1575 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1576 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1577 call Interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1578 catch /^Vim:Interrupt$/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1579 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1580 finish
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1581 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1582 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1583
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1584 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
1585 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
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 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1588 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1589 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1590 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1591
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1592 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
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 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1595 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1596 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1597 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1598 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1599 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
1600 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1601 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1602 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1603
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1604 func Test_finally_after_throw()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1605 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1606 func Throw()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1607 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1608 throw 'xyz'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1609 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1610
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1611 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1612 call Throw()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1613 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1614
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1615 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
1616 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
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 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1619 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1620 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1621 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1622
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1623 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
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 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1626 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1627 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1628 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1629 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1630 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
1631 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1632 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1633 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1634
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 " 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
1637 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1638 " 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
1639 " 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
1640 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1641
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1642 func Test_catch_after_throw()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1643 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1644 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1645 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1646 throw "xyz"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1647 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1648
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1649 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
1650 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
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 catch /xyz/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1653 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1654 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1655 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1656 catch /xyz/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1657 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1658 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1659
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1660 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1661 throw "abc"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1662 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1663
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1664 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
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 catch /abc/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1667 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1668 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1669 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1670 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1671 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
1672 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1673 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1674 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1675
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 " 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
1678 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1679 " 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
1680 " 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
1681 " active :try conditional.
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1682 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1683
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1684 func Test_endtry_after_throw()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1685 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1686 try " try 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1687 try " try 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1688 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1689 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
1690 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1691
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1692 try " try 3
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1693 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1694 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
1695 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
1696 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1697 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1698 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
1699 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1700 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1701 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1702 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1703 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1704 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
1705 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1706 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1707 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1708
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 " 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
1711 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1712 " 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
1713 " :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
1714 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1715
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1716 func T27_F()
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 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1719 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1720 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1721 return
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1722 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1723 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1724 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1725 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1726 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1727 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1728 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1729 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1730 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1731 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1732
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1733 func T27_G()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1734 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1735 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1736 return
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1737 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1738 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1739 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1740 call T27_F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1741 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1742 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1743 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1744 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1745
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1746 func T27_H()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1747 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1748 Xpath 'i'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1749 call T27_G()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1750 Xpath 'j'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1751 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1752 Xpath 'k'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1753 return
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1756 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1757 endfunction
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1758
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1759 func Test_finally_after_return()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1760 XpathINIT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1761 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1762 Xpath 'l'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1763 call T27_H()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1764 Xpath 'm'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1765 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1766 Xpath 'n'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1767 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1768 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
1769 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1770
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 " 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
1773 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1774 " 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
1775 " :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
1776 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1777 " 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
1778 " 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
1779 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1780
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1781 func Test_finally_after_finish()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1782 XpathINIT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1783
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1784 let scriptF = MakeScript("T27_F")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1785 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
1786 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
1787
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1788 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1789 Xpath 'A'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1790 exec "source" scriptH
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1791 Xpath 'B'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1792 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1793 Xpath 'C'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1794 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1795 Xpath 'D'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1796 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
1797 call delete(scriptF)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1798 call delete(scriptG)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1799 call delete(scriptH)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1800 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1801
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 " 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
1804 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1805 " 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
1806 " 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
1807 " terminated.
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1808 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1809
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1810 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
1811 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1812 func F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1813 while 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1814 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1815 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1816 while 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1817 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1818 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1819 asdf " error
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1820 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1821 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1822 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1823 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
1824 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1825 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1826 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1827 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1828 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1829 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1830 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
1831 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1832 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1833 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1834 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1835 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1836
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1837 while 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1838 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1839 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1840 while 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1841 call F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1842 call assert_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 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1844 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
1845 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1846 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1847 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1848 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
1849 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
1850 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1851 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1852 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1853 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
1854 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1855 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1856 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1857
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1858 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
1859 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1860 func G() abort
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1861 if 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1862 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1863 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1864 asdf " error
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1865 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1866 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1867 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1868 endtry | Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1869 endif | Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1870 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1871 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1872
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1873 if 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1874 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1875 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1876 call G()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1877 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1878 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1879 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1880 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
1881 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
1882 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1883 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1884 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1885 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
1886 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1887 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1888 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1889
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 " 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
1892 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1893 " 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
1894 " 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
1895 " script processing is terminated.
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1896 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1897
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1898 func Test_finally_on_interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1899 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1900 func F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1901 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1902 Xloop 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1903 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1904 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1905 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1906 Xloop 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1907 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1908 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1909 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1910
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1911 try
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 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1914 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1915 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1916 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1917 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1918 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1919 Xpath 'e'
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 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1922 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1923 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1924 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1925 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1926 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1927 Xpath 'i'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1928 call interrupt()
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1937 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1938 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1939 Xpath 'j'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1940 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1941 Xpath 'k'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1942 call F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1943 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1944 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1945 Xpath 'l'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1946 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1947 Xpath 'm'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1948 XloopNEXT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1949 ExecAsScript F
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1950 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1951 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1952 Xpath 'n'
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1958 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1959 catch /^Vim:Interrupt$/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1960 Xpath 'o'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1961 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1962 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1963 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1964 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
1965 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1966 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1967 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1968
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 " 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
1971 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1972 " 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
1973 " :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
1974 " terminated.
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1975 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1976
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1977 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
1978 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1979 func F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1980 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1981 Xloop 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1982 throw "exception"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1983 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1984 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1985 Xloop 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1986 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1987 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1988 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1989
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 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1992 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1993 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1994 throw "exception"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1995 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1996 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
1997 Xpath 'e'
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 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2000 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2001 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2002 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2003 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2004 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2005 Xpath 'i'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2006 throw "exception"
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2015 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2016 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2017 Xpath 'j'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2018 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2019 Xpath 'k'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2020 call F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2021 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2022 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2023 Xpath 'l'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2024 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2025 Xpath 'm'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2026 XloopNEXT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2027 ExecAsScript F
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2028 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2029 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2030 Xpath 'n'
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2036 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2037 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2038 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2039 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
2040 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2041 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2042 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2043
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 " 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
2046 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2047 " 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
2048 " :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
2049 " 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
2050 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2051
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2052 func Test_finally_after_continue()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2053 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2054 func C(jump)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2055 XloopNEXT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2056 let loop = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2057 while loop < 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2058 let loop = loop + 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2059 if loop == 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2060 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2061 if a:jump == "continue"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2062 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2063 elseif a:jump == "break"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2064 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2065 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
2066 return
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2067 elseif a:jump == "error"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2068 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2069 elseif a:jump == "interrupt"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2070 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2071 let dummy = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2072 elseif a:jump == "throw"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2073 throw "abc"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2074 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2075 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2076 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
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2079 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2080 elseif loop == 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2081 Xloop 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2082 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2083 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2084 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2085
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2086 call C("continue")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2087 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2088 call C("break")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2089 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2090 call C("return")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2091 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2092 let g:jump = "finish"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2093 ExecAsScript C
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2094 unlet g:jump
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2095 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2096 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2097 call C("error")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2098 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2099 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2100 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2101 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2102 call C("interrupt")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2103 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2104 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2105 Xpath 'i'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2106 call C("throw")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2107 Xpath 'j'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2108 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2109 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2110 Xpath 'k'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2111 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2112 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2113 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
2114 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2115 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2116 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2117
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 " 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
2120 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2121 " 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
2122 " :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
2123 " 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
2124 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2125
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2126 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
2127 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2128 func B(jump)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2129 XloopNEXT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2130 let loop = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2131 while loop < 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2132 let loop = loop + 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2133 if loop == 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2134 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2135 if a:jump == "continue"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2136 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2137 elseif a:jump == "break"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2138 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2139 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
2140 return
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2141 elseif a:jump == "error"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2142 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2143 elseif a:jump == "interrupt"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2144 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2145 let dummy = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2146 elseif a:jump == "throw"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2147 throw "abc"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2148 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2149 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2150 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
2151 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2152 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2153 elseif loop == 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2154 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2155 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2156 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2157 Xloop 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2158 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2159
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2160 call B("continue")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2161 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2162 call B("break")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2163 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2164 call B("return")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2165 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2166 let g:jump = "finish"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2167 ExecAsScript B
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2168 unlet g:jump
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2169 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2170 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2171 call B("error")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2172 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2173 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2174 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2175 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2176 call B("interrupt")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2177 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2178 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2179 Xpath 'i'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2180 call B("throw")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2181 Xpath 'j'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2182 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2183 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2184 Xpath 'k'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2185 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2186 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2187 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
2188 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2189 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2190 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2191
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 " 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
2194 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2195 " 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
2196 " :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
2197 " 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
2198 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2199
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2200 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
2201 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2202 func R(jump, retval) abort
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2203 let loop = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2204 while loop < 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2205 let loop = loop + 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2206 if loop == 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2207 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2208 if a:jump == "continue"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2209 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2210 elseif a:jump == "break"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2211 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2212 elseif a:jump == "return"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2213 return
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2214 elseif a:jump == "error"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2215 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2216 elseif a:jump == "interrupt"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2217 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2218 let dummy = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2219 elseif a:jump == "throw"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2220 throw "abc"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2221 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2222 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2223 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
2224 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2225 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2226 elseif loop == 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2227 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2228 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2229 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2230 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2231 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2232
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2233 let sum = -R("continue", -8)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2234 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2235 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
2236 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2237 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
2238 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2239 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2240 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
2241 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2242 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2243 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2244 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2245 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
2246 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2247 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2248 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2249 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
2250 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2251 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2252 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2253 Xpath 'i'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2254
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2255 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
2256 call assert_equal(sum, expected)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2257 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2258 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2259 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
2260 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2261 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2262 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2263
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 " 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
2266 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2267 " 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
2268 " :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
2269 " 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
2270 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2271
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2272 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
2273 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2274 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
2275 let loop = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2276 while loop < 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2277 let loop = loop + 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2278 if loop == 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2279 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2280 if a:jump == "continue"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2281 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2282 elseif a:jump == "break"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2283 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2284 elseif a:jump == "finish"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2285 finish
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2286 elseif a:jump == "error"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2287 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2288 elseif a:jump == "interrupt"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2289 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2290 let dummy = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2291 elseif a:jump == "throw"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2292 throw "abc"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2293 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2294 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2295 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
2296 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2297 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2298 elseif loop == 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2299 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2300 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2301 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2302 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2303 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2304
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2305 let scriptF = MakeScript("F")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2306 delfunction F
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2307
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2308 let g:jump = "continue"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2309 exec "source" scriptF
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2310 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2311 let g:jump = "break"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2312 exec "source" scriptF
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2313 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2314 let g:jump = "finish"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2315 exec "source" scriptF
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2316 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2317 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2318 let g:jump = "error"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2319 exec "source" scriptF
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2320 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2321 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2322 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2323 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2324 let g:jump = "interrupt"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2325 exec "source" scriptF
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2326 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2327 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2328 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2329 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2330 let g:jump = "throw"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2331 exec "source" scriptF
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2332 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2333 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2334 Xpath 'i'
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2337 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2338 unlet g:jump
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2339 call delete(scriptF)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2340 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2341 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2342 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
2343 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2344 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2345 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2346
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 " 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
2349 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2350 " 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
2351 " :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
2352 " 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
2353 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2354
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2355 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
2356 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2357 func E(jump)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2358 let loop = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2359 while loop < 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2360 let loop = loop + 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2361 if loop == 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2362 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2363 if a:jump == "continue"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2364 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2365 elseif a:jump == "break"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2366 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2367 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
2368 return
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2369 elseif a:jump == "error"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2370 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2371 elseif a:jump == "interrupt"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2372 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2373 let dummy = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2374 elseif a:jump == "throw"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2375 throw "abc"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2376 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2377 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2378 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
2379 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2380 elseif loop == 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2381 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2382 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2383 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2384 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2385 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2386
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2387 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2388 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2389 call E("continue")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2390 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2391 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2392 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2393 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2394 call E("break")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2395 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2396 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2397 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2398 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2399 call E("return")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2400 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2401 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2402 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2403 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2404 let g:jump = "finish"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2405 ExecAsScript E
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2406 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2407 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2408 unlet g:jump
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2409 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2410 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2411 call E("error")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2412 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2413 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2414 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2415 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2416 call E("interrupt")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2417 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2418 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2419 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2420 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2421 call E("throw")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2422 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2423 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2424 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2425 delfunction E
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2432 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2433 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2434 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2435 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2436 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
2437 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2438 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2439 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2440
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 " 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
2443 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2444 " 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
2445 " :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
2446 " 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
2447 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2448
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2449 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
2450 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2451 func I(jump)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2452 let loop = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2453 while loop < 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2454 let loop = loop + 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2455 if loop == 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2456 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2457 if a:jump == "continue"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2458 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2459 elseif a:jump == "break"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2460 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2461 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
2462 return
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2463 elseif a:jump == "error"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2464 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2465 elseif a:jump == "interrupt"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2466 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2467 let dummy = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2468 elseif a:jump == "throw"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2469 throw "abc"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2470 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2471 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2472 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2473 let dummy = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2474 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2475 elseif loop == 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2476 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2477 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2478 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2479 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2480 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2481
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2482 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2483 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2484 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2485 call I("continue")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2486 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2487 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2488 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2489 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2490 call I("break")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2491 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2492 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2493 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2494 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2495 call I("return")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2496 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2497 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2498 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2499 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2500 let g:jump = "finish"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2501 ExecAsScript I
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2502 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2503 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2504 unlet g:jump
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2505 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2506 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2507 call I("error")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2508 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2509 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2510 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2511 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2512 call I("interrupt")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2513 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2514 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2515 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2516 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2517 call I("throw")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2518 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2519 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2520 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2521 delfunction I
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2528 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2529 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2530 catch /^Vim:Interrupt$/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2531 Xpath 'A'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2532 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2533 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2534 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2535 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
2536 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2537 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2538 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2539
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 " 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
2542 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2543 " 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
2544 " :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
2545 " 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
2546 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2547
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2548 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
2549 let test =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2550 func T(jump)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2551 let loop = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2552 while loop < 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2553 let loop = loop + 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2554 if loop == 1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2555 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2556 if a:jump == "continue"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2557 continue
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2558 elseif a:jump == "break"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2559 break
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2560 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
2561 return
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2562 elseif a:jump == "error"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2563 asdf
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2564 elseif a:jump == "interrupt"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2565 call interrupt()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2566 let dummy = 0
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2567 elseif a:jump == "throw"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2568 throw "abc"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2569 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2570 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2571 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
2572 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2573 elseif loop == 2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2574 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2575 endif
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2576 endwhile
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2577 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2578 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2579
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2580 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2581 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2582 call T("continue")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2583 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2584 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2585 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2586 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2587 call T("break")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2588 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2589 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2590 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2591 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2592 call T("return")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2593 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2594 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2595 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2596 Xpath 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2597 let g:jump = "finish"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2598 ExecAsScript T
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2599 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2600 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2601 unlet g:jump
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2602 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2603 Xpath 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2604 call T("error")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2605 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2606 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2607 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2608 Xpath 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2609 call T("interrupt")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2610 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2611 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2612 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2613 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2614 call T("throw")
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2615 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2616 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2617 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2618 delfunction T
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 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2625 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2626 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2627 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2628 let verify =<< trim [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2629 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
2630 [CODE]
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2631 call RunInNewVim(test, verify)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2632 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2633
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 " 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
2636 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2637 " 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
2638 " 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
2639 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2640
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2641 func T49_C()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2642 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2643 Xpath 'a'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2644 throw "arrgh"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2645 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2646 catch /arrgh/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2647 Xpath 'b'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2648 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2649 Xpath 'c'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2650 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2651
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2652 func T49_T1()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2653 XloopNEXT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2654 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2655 Xloop 'd'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2656 throw "arrgh"
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2657 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2658 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2659 Xloop 'e'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2660 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2661 Xloop 'f'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2662 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2663
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2664 func T49_T2()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2665 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2666 Xpath 'g'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2667 call T49_T1()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2668 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2669 finally
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2670 Xpath 'h'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2671 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2672 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2673 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2674
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2675 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
2676 XpathINIT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2677 XloopINIT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2678 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2679 Xpath 'i'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2680 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
2681 Xpath 'j'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2682 catch /.*/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2683 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2684 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2685
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2686 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2687 Xpath 'k'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2688 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
2689 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2690 catch /arrgh/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2691 Xpath 'l'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2692 catch /.*/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2693 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2694 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2695
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2696 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2697 Xpath 'm'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2698 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
2699 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2700 catch /arrgh/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2701 Xpath 'n'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2702 catch /.*/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2703 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2704 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2705 Xpath 'o'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2706
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2707 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
2708 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2709
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 " 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
2712 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2713 " 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
2714 " 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
2715 " clause.
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2716 "
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2717 " 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
2718 " 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
2719 "-------------------------------------------------------------------------------
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2720
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2721 func T50_F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2722 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2723 Xpath 'A'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2724 exec "source" g:scriptC
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2725 Xpath 'B'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2726 catch /.*/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2727 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2728 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2729
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2730 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2731 Xpath 'C'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2732 exec "source" g:scriptT1
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2733 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2734 catch /arrgh/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2735 Xpath 'D'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2736 catch /.*/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2737 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2738 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2739 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2740
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2741 func Test_throw_across_script()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2742 XpathINIT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2743 XloopINIT
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2744 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
2745 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
2746 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
2747
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2748 try
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2749 Xpath 'E'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2750 call T50_F()
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2751 Xpath 'F'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2752 exec "source" scriptT2
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2753 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2754 catch /arrgh/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2755 Xpath 'G'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2756 catch /.*/
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2757 call assert_report('should not get here')
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2758 endtry
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2759 Xpath 'H'
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2760 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
2761
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2762 call delete(g:scriptC)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2763 call delete(g:scriptT1)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2764 call delete(scriptT2)
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2765 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
2766 endfunc
792398a9fe39 patch 8.2.1366: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21110
diff changeset
2767
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
2768 "-------------------------------------------------------------------------------
21666
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2769 " Test 52: Uncaught exceptions {{{1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2770 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2771 " 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
2772 " 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
2773 " 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
2774 " displayed.
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2775 "-------------------------------------------------------------------------------
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2776
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2777 func Test_uncaught_exception_1()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2778 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2779
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2780 let test =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2781 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2782 throw "arrgh"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2783 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
2784 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2785 let verify =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2786 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
2787 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
2788 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2789 call RunInNewVim(test, verify)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2790 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2791
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2792 func Test_uncaught_exception_2()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2793 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2794
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2795 let test =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2796 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2797 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2798 throw "oops"
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 catch /arrgh/
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 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2803 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
2804 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2805 let verify =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2806 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
2807 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
2808 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2809 call RunInNewVim(test, verify)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2810 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2811
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2812 func Test_uncaught_exception_3()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2813 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2814
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2815 let test =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2816 func T()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2817 Xpath 'c'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2818 throw "brrr"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2819 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
2820 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2821
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2822 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2823 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2824 throw "arrgh"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2825 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
2826 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2827 Xpath 'b'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2828 call T()
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 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2831 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
2832 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2833 let verify =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2834 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
2835 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
2836 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2837 call RunInNewVim(test, verify)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2838 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2839
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2840 func Test_uncaught_exception_4()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2841 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2842
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2843 let test =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2844 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2845 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2846 throw "arrgh"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2847 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
2848 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2849 Xpath 'b'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2850 throw "brrr"
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 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2853 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
2854 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2855 let verify =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2856 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
2857 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
2858 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2859 call RunInNewVim(test, verify)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2860 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2861
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2862 func Test_uncaught_exception_5()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2863 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2864
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2865 " 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
2866 " 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
2867 let test =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2868 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2869 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2870 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2871 call interrupt()
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 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2874 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
2875 catch /^Vim:Interrupt$/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2876 Xpath 'b'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2877 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2878 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2879 let verify =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2880 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
2881 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2882 call RunInNewVim(test, verify)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2883 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2884
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2885 func Test_uncaught_exception_6()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2886 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2887
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2888 let test =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2889 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2890 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2891 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
2892 catch /E15:/ " should not catch
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 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2895 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
2896 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2897 let verify =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2898 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
2899 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
2900 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2901 call RunInNewVim(test, verify)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2902 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2903
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2904 func Test_uncaught_exception_7()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2905 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2906
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2907 let test =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2908 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2909 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2910 " error E108/E488; exception: E488
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2911 unlet novar #
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2912 catch /E108:/ " should not catch
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 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2915 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
2916 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2917 let verify =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2918 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
2919 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
2920 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2921 call RunInNewVim(test, verify)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2922 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2923
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 " 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
2926 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2927 " 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
2928 " should be given.
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2929 "-------------------------------------------------------------------------------
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2930
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2931 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
2932 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2933
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2934 " :endif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2935 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2936 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2937 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2938 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2939 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
2940
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2941 " :endif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2942 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2943 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2944 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2945 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2946 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2947 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2948 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
2949
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2950 " :endif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2951 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2952 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2953 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2954 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2955 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2956 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2957 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2958 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
2959
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2960 " :endif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2961 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2962 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2963 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2964 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2965 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2966 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2967 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
2968
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2969 " :endif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2970 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2971 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2972 throw "a"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2973 catch /a/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2974 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2975 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2976 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2977 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2978 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
2979
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2980 " :else without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2981 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2982 else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2983 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2984 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2985 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
2986
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2987 " :else without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2988 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2989 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2990 else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2991 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2992 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2993 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2994 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
2995
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2996 " :else without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2997 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2998 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
2999 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3000 else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3001 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3002 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3003 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3004 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
3005
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3006 " :else without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3007 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3008 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3009 else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3010 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3011 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3012 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3013 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
3014
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3015 " :else without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3016 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3017 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3018 throw "a"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3019 catch /a/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3020 else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3021 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3022 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3023 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3024 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
3025
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3026 " :elseif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3027 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3028 elseif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3029 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3030 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3031 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
3032
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3033 " :elseif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3034 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3035 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3036 elseif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3037 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3038 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3039 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3040 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
3041
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3042 " :elseif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3043 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3044 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3045 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3046 elseif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3047 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3048 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3049 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3050 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
3051
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3052 " :elseif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3053 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3054 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3055 elseif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3056 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3057 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3058 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3059 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
3060
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3061 " :elseif without :if
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3062 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3063 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3064 throw "a"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3065 catch /a/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3066 elseif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3067 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3068 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3069 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3070 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
3071
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3072 " multiple :else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3073 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3074 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3075 else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3076 else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3077 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3078 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3079 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3080 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
3081
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3082 " :elseif after :else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3083 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3084 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3085 else
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3086 elseif 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3087 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3088 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3089 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3090 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
3091
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3092 call delete('Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3093 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3094
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 " 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
3097 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3098 " 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
3099 " should be given.
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3100 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3101 " 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
3102 " 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
3103 "-------------------------------------------------------------------------------
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3104
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3105 func Test_nested_while_error()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3106 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3107
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3108 " :endwhile without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3109 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3110 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3111 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3112 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3113 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
3114
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3115 " :endwhile without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3116 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3117 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3118 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3119 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3120 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3121 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3122 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
3123
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3124 " Missing :endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3125 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3126 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3127 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3128 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3129 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3130 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3131 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
3132
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3133 " :endwhile without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3134 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3135 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3136 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3137 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3138 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3139 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3140 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3141 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
3142
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3143 " Missing :endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3144 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3145 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3146 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3147 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3148 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3149 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3150 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3151 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
3152
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3153 " Missing :endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3154 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3155 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3156 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3157 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3158 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3159 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3160 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3161 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3162 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
3163
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3164 " Missing :endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3165 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3166 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3167 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3168 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3169 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3170 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3171 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3172 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3173 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
3174
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3175 " :endwhile without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3176 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3177 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3178 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3179 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3180 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3181 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3182 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
3183
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3184 " :endwhile without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3185 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3186 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3187 try
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 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3190 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3191 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3192 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3193 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
3194
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3195 " :endwhile without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3196 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3197 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3198 throw "a"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3199 catch /a/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3200 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3201 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3202 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3203 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3204 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
3205
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3206 " :endwhile without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3207 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3208 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3209 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3210 throw "a"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3211 catch /a/
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 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3214 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3215 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3216 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3217 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
3218
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3219 call delete('Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3220 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3221
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 " 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
3224 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3225 " 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
3226 " error messages should be given.
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3227 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3228 " 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
3229 " 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
3230 "-------------------------------------------------------------------------------
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3231
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3232 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
3233 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3234
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3235 " :continue without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3236 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3237 continue
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3238 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3239 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3240 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
3241
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3242 " :continue without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3243 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3244 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3245 continue
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3246 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3247 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3248 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3249 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
3250
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3251 " :continue without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3252 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3253 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3254 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3255 continue
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3256 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3257 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3258 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3259 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
3260
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3261 " :continue without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3262 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3263 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3264 continue
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3265 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3266 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3267 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3268 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
3269
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3270 " :continue without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3271 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3272 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3273 throw "a"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3274 catch /a/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3275 continue
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3276 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3277 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3278 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3279 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
3280
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3281 " :break without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3282 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3283 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3284 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3285 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3286 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
3287
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3288 " :break without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3289 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3290 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3291 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3292 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3293 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3294 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3295 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
3296
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3297 " :break without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3298 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3299 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3300 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3301 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3302 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3303 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3304 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3305 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
3306
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3307 " :break without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3308 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3309 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3310 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3311 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3312 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3313 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3314 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
3315
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3316 " :break without :while
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3317 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3318 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3319 throw "a"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3320 catch /a/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3321 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3322 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3323 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3324 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3325 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
3326
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3327 call delete('Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3328 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3329
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 " 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
3332 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3333 " 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
3334 " should be given.
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3335 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3336 " 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
3337 " 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
3338 "-------------------------------------------------------------------------------
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3339
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3340 func Test_nested_endtry_error()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3341 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3342
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3343 " :endtry without :try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3344 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3345 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3346 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3347 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3348 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
3349
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3350 " :endtry without :try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3351 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3352 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3353 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3354 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3355 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3356 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3357 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
3358
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3359 " :endtry without :try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3360 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3361 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3362 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3363 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3364 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3365 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3366 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
3367
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3368 " Missing :endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3369 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3370 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3371 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3372 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3373 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3374 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3375 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
3376
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3377 " Missing :endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3378 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3379 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3380 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3381 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3382 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3383 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3384 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
3385
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3386 " Missing :endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3387 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3388 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3389 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3390 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3391 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3392 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3393 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3394 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
3395
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3396 " Missing :endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3397 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3398 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3399 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3400 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3401 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3402 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3403 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3404 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
3405
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3406 " Missing :endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3407 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3408 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3409 throw "a"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3410 catch /a/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3411 if 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3412 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3413 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3414 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3415 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
3416
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3417 " Missing :endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3418 let code =<< trim END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3419 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3420 throw "a"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3421 catch /a/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3422 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3423 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3424 END
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3425 call writefile(code, 'Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3426 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
3427
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3428 call delete('Xtest')
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3429 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3430
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 " 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
3433 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3434 " 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
3435 " 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
3436 " 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
3437 " 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
3438 " 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
3439 "-------------------------------------------------------------------------------
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3440
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3441 func Test_user_exception_info()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3442 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3443
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3444 XpathINIT
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3445 XloopINIT
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3446
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3447 func FuncException()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3448 let g:exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3449 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3450
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3451 func FuncThrowpoint()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3452 let g:throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3453 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3454
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3455 let scriptException = MakeScript("FuncException")
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3456 let scriptThrowPoint = MakeScript("FuncThrowpoint")
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3457
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3458 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
3459 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
3460
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3461 func T(arg, line)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3462 if a:line == 2
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 2
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3464 elseif a:line == 4
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 4
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3466 elseif a:line == 6
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 6
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3468 elseif a:line == 8
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3469 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
3470 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3471 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3472
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3473 func G(arg, line)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3474 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
3475 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3476
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3477 func F(arg, line)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3478 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
3479 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3480
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3481 let scriptT = MakeScript("T")
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3482 let scriptG = MakeScript("G", scriptT)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3483 let scriptF = MakeScript("F", scriptG)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3484
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3485 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3486 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3487 call F("oops", 2)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3488 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3489 Xpath 'b'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3490 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3491 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3492 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
3493 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
3494 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
3495
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3496 exec "let exception = v:exception"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3497 exec "let throwpoint = v:throwpoint"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3498 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
3499 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
3500 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
3501
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3502 CmdException
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3503 CmdThrowpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3504 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
3505 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
3506 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
3507
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3508 call FuncException()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3509 call FuncThrowpoint()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3510 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
3511 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
3512 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
3513
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3514 exec "source" scriptException
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3515 exec "source" scriptThrowPoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3516 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
3517 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
3518 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
3519
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3520 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3521 Xpath 'c'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3522 call G("arrgh", 4)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3523 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3524 Xpath 'd'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3525 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3526 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3527 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
3528 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
3529 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
3530
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3531 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3532 Xpath 'e'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3533 let g:arg = "autsch"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3534 let g:line = 6
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3535 exec "source" scriptF
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3536 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3537 Xpath 'f'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3538 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3539 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3540 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
3541 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
3542 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
3543 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3544 Xpath 'g'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3545 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3546 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3547 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
3548 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
3549 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
3550 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3551 Xpath 'h'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3552 let g:arg = "brrrr"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3553 let g:line = 8
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3554 exec "source" scriptG
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3555 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3556 Xpath 'i'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3557 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3558 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3559 " 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
3560 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
3561 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
3562 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
3563 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3564 Xpath 'j'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3565 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3566 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3567 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
3568 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
3569 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
3570 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3571 Xpath 'k'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3572 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3573 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3574 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
3575 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
3576 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
3577 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3578 Xpath 'l'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3579 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3580 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3581 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
3582 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
3583 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
3584 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3585 Xpath 'm'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3586 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3587 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3588 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
3589 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
3590 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
3591 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3592 Xpath 'n'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3593 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3594 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3595 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
3596 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
3597 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
3598 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3599 Xpath 'o'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3600 let exception = v:exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3601 let throwpoint = v:throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3602 call assert_equal("", v:exception)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3603 call assert_match('^$', v:throwpoint)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3604 call assert_match('^$', v:throwpoint)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3605 endtry
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 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
3608
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3609 unlet exception throwpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3610 delfunction FuncException
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3611 delfunction FuncThrowpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3612 call delete(scriptException)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3613 call delete(scriptThrowPoint)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3614 unlet scriptException scriptThrowPoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3615 delcommand CmdException
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3616 delcommand CmdThrowpoint
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3617 delfunction T
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3618 delfunction G
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3619 delfunction F
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3620 call delete(scriptT)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3621 call delete(scriptG)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3622 call delete(scriptF)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3623 unlet scriptT scriptG scriptF
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3624 endfunc
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 "-------------------------------------------------------------------------------
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 " 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
3629 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3630 " 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
3631 " exceptions.
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3632 "-------------------------------------------------------------------------------
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3633
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3634 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
3635 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3636
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3637 let test =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3638 func T(line)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3639 if a:line == 2
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3640 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
3641 elseif a:line == 4
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3642 call interrupt()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3643 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3644 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3645
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3646 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3647 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3648 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3649 call T(2)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3650 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
3651 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3652 Xpath 'b'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3653 if v:exception !~ 'Vim(delfunction):'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3654 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
3655 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3656 if v:throwpoint !~ '\<T\>'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3657 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
3658 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3659 if v:throwpoint !~ '\<2\>'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3660 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
3661 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3662 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3663 Xpath 'c'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3664 if v:exception != ""
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3665 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
3666 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3667 if v:throwpoint != ""
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3668 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
3669 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3670 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3671 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3672 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3673
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3674 Xpath 'd'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3675 if v:exception != ""
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3676 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
3677 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3678 if v:throwpoint != ""
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3679 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
3680 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3681
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3682 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3683 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3684 Xpath 'e'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3685 call T(4)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3686 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
3687 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3688 Xpath 'f'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3689 if v:exception != 'Vim:Interrupt'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3690 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
3691 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3692 if v:throwpoint !~ 'function T'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3693 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
3694 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3695 if v:throwpoint !~ '\<4\>'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3696 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
3697 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3698 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3699 Xpath 'g'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3700 if v:exception != ""
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3701 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
3702 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3703 if v:throwpoint != ""
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3704 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
3705 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3706 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3707 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3708 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3709
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3710 Xpath 'h'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3711 if v:exception != ""
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3712 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
3713 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3714 if v:throwpoint != ""
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3715 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
3716 endif
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3717 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3718 let verify =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3719 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
3720 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3721 call RunInNewVim(test, verify)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3722 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3723
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
3724 "-------------------------------------------------------------------------------
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3725 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3726 " Test 59: v:exception and v:throwpoint when discarding exceptions {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3727 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3728 " When a :catch clause is left by a ":break" etc or an error or
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3729 " interrupt exception, v:exception and v:throwpoint are reset. They
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3730 " are not affected by an exception that is discarded before being
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3731 " caught.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3732 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3733 func Test_exception_info_on_discard()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3734 CheckEnglish
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3736 let test =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3737 let sfile = expand("<sfile>")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3738
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3739 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3740 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3741 throw "x1"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3742 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3743 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3744 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3745 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3746 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3747 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3748
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3749 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3750 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3751 throw "x2"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3752 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3753 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3754 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3755 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3756 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3757 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3758 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3759 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3760 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3761 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3762
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3763 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3764 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3765 let errcaught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3766 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3767 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3768 throw "x3"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3769 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3770 let lnum = expand("<sflnum>")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3771 asdf
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3772 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3773 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3774 let errcaught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3775 call assert_match('Vim:E492: Not an editor command:', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3776 call assert_match('line ' .. (lnum + 1), v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3777 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3778 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3779 call assert_equal(1, errcaught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3780 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3781 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3782 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3783 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3784 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3785
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3786 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3787
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3788 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3789 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3790 let intcaught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3791 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3792 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3793 throw "x4"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3794 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3795 let lnum = expand("<sflnum>")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3796 call interrupt()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3797 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3798 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3799 let intcaught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3800 call assert_match('Vim:Interrupt', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3801 call assert_match('line ' .. (lnum + 1), v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3802 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3803 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3804 call assert_equal(1, intcaught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3805 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3806 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3807 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3808 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3809 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3810
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3811 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3812
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3813 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3814 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3815 let errcaught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3816 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3817 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3818 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3819 let lnum = expand("<sflnum>")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3820 throw "x5"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3821 " missing endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3822 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3823 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3824 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3825 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3826 let errcaught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3827 call assert_match('Vim(catch):E171: Missing :endif:', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3828 call assert_match('line ' .. (lnum + 3), v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3829 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3830 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3831 call assert_equal(1, errcaught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3832 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3833 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3834 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3835 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3836 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3837
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3838 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3839
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3840 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3841 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3842 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3843 throw "x6"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3844 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3845 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3846 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3847 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3848 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3849 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3850 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3851 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3852 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3853 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3854
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3855 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3856 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3857 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3858 throw "x7"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3859 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3860 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3861 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3862 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3863 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3864 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3865 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3866 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3867 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3868 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3869 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3870 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3871 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3872
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3873 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3874 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3875 let errcaught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3876 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3877 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3878 throw "x8"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3879 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3880 let lnum = expand("<sflnum>")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3881 asdf
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3882 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3883 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3884 let errcaught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3885 call assert_match('Vim:E492: Not an editor command:', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3886 call assert_match('line ' .. (lnum + 1), v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3887 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3888 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3889 call assert_equal(1, errcaught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3890 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3891 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3892 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3893 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3894 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3895
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3896 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3897
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3898 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3899 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3900 let intcaught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3901 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3902 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3903 throw "x9"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3904 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3905 let lnum = expand("<sflnum>")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3906 call interrupt()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3907 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3908 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3909 let intcaught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3910 call assert_match('Vim:Interrupt', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3911 call assert_match('line ' .. (lnum + 1), v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3912 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3913 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3914 call assert_equal(1, intcaught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3915 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3916 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3917 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3918 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3919 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3920
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3921 Xpath 'e'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3922
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3923 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3924 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3925 let errcaught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3926 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3927 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3928 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3929 let lnum = expand("<sflnum>")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3930 throw "x10"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3931 " missing endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3932 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3933 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3934 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3935 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3936 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3937 let errcaught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3938 call assert_match('Vim(finally):E171: Missing :endif:', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3939 call assert_match('line ' .. (lnum + 3), v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3940 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3941 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3942 call assert_equal(1, errcaught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3943 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3944 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3945 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3946 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3947 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3948
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3949 Xpath 'f'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3950
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3951 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3952 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3953 let errcaught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3954 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3955 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3956 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3957 let lnum = expand("<sflnum>")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3958 throw "x11"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3959 " missing endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3960 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3961 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3962 let errcaught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3963 call assert_match('Vim(endtry):E171: Missing :endif:', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3964 call assert_match('line ' .. (lnum + 3), v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3965 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3966 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3967 call assert_equal(1, errcaught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3968 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3969 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3970 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3971 call assert_equal('', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3972 call assert_equal('', v:throwpoint)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3973
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3974 Xpath 'g'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3975 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3976 let verify =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3977 call assert_equal('abcdefg', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3978 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3979 call RunInNewVim(test, verify)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3980 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3981
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3982 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3983 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3984 " Test 60: (Re)throwing v:exception; :echoerr. {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3985 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3986 " A user exception can be rethrown after catching by throwing
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3987 " v:exception. An error or interrupt exception cannot be rethrown
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3988 " because Vim exceptions cannot be faked. A Vim exception using the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3989 " value of v:exception can, however, be triggered by the :echoerr
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3990 " command.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3991 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3992
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3993 func Test_rethrow_exception_1()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3994 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3995 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3996 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3997 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3998 throw "oops"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
3999 catch /oops/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4000 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4001 throw v:exception " rethrow user exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4002 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4003 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4004 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4005 catch /^oops$/ " catches rethrown user exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4006 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4007 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4008 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4009 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4010 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4011 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4012
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4013 func Test_rethrow_exception_2()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4014 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4015 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4016 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4017 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4018 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4019 write /n/o/n/w/r/i/t/a/b/l/e/_/f/i/l/e
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4020 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4021 catch /^Vim(write):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4022 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4023 throw v:exception " throw error: cannot fake Vim exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4024 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4025 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4026 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4027 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4028 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4029 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4030 catch /^Vim(throw):/ " catches throw error
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4031 let caught = caught + 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4032 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4033 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4034 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4035 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4036 call assert_equal(2, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4037 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4038 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4039 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4040
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4041 func Test_rethrow_exception_3()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4042 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4043 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4044 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4045 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4046 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4047 asdf
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4048 catch /^Vim/ " catch error exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4049 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4050 " Trigger Vim error exception with value specified after :echoerr
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4051 let value = substitute(v:exception, '^Vim\((.*)\)\=:', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4052 echoerr value
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4053 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4054 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4055 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4056 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4057 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4058 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4059 catch /^Vim(echoerr):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4060 let caught = caught + 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4061 call assert_match(value, v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4062 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4063 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4064 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4065 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4066 call assert_equal(2, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4067 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4068 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4069 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4070
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4071 func Test_rethrow_exception_3()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4072 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4073 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4074 let errcaught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4075 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4076 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4077 let intcaught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4078 call interrupt()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4079 catch /^Vim:/ " catch interrupt exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4080 let intcaught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4081 " Trigger Vim error exception with value specified after :echoerr
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4082 echoerr substitute(v:exception, '^Vim\((.*)\)\=:', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4083 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4084 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4085 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4086 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4087 call assert_equal(1, intcaught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4088 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4089 catch /^Vim(echoerr):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4090 let errcaught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4091 call assert_match('Interrupt', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4092 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4093 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4094 call assert_equal(1, errcaught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4095 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4096 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4097 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4098
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4099 "-------------------------------------------------------------------------------
21666
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4100 " 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
4101 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4102 " 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
4103 " 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
4104 " "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
4105 " 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
4106 " 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
4107 " 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
4108 " 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
4109 " 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
4110 "-------------------------------------------------------------------------------
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4111
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4112 func Test_catch_intr_exception()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4113 let test =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4114 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4115 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4116 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4117 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4118 call interrupt()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4119 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
4120 catch /^Vim:Interrupt$/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4121 Xpath 'b'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4122 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4123 Xpath 'c'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4124 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4125 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4126 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
4127 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4128 Xpath 'd'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4129 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4130 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4131 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4132
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4133 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4134 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4135 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4136 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4137 Xpath 'e'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4138 asdf
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4139 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
4140 catch /do_not_catch/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4141 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
4142 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4143 Xpath 'f'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4144 call interrupt()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4145 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
4146 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4147 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
4148 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4149 Xpath 'g'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4150 call interrupt()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4151 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
4152 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4153 catch /^Vim:Interrupt$/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4154 Xpath 'h'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4155 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4156 Xpath 'i'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4157 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4158 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4159 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
4160 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4161 Xpath 'j'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4162 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4163 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4164 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4165
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4166 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4167 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4168 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4169 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4170 Xpath 'k'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4171 throw "x"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4172 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
4173 catch /do_not_catch/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4174 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
4175 catch /x/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4176 Xpath 'l'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4177 call interrupt()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4178 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
4179 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4180 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
4181 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4182 catch /^Vim:Interrupt$/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4183 Xpath 'm'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4184 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4185 Xpath 'n'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4186 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4187 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4188 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
4189 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4190 Xpath 'o'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4191 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4192 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4193 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4194
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4195 while 1
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4196 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4197 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4198 Xpath 'p'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4199 call interrupt()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4200 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
4201 catch /do_not_catch/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4202 call interrupt()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4203 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
4204 catch /^Vim:Interrupt$/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4205 Xpath 'q'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4206 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4207 Xpath 'r'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4208 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4209 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4210 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
4211 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4212 Xpath 's'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4213 break
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4214 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4215 endwhile
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4216
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4217 Xpath 't'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4218 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4219 let verify =<< trim [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4220 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
4221 [CODE]
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4222 call RunInNewVim(test, verify)
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4223 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4224
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4225 "-------------------------------------------------------------------------------
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4226 " Test 62: Catching error exceptions {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4227 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4228 " An error inside a :try/:endtry region is converted to an exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4229 " and can be caught. The error exception has a "Vim(cmdname):" prefix
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4230 " where cmdname is the name of the failing command, or a "Vim:" prefix
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4231 " if no command name is known. The "Vim" prefixes cannot be faked.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4232 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4233
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4234 func Test_catch_err_exception_1()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4235 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4236 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4237 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4238 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4239 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4240 unlet novar
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4241 catch /^Vim(unlet):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4242 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4243 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4244 let v:errmsg = substitute(v:exception, '^Vim(unlet):', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4245 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4246 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4247 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4248 call assert_match('E108: No such variable: "novar"', v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4249 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4250 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4251 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4252 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4253 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4254 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4255 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4256 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4257 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4258 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4259 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4260
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4261 func Test_catch_err_exception_2()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4262 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4263 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4264 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4265 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4266 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4267 throw novar " error in :throw
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4268 catch /^Vim(throw):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4269 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4270 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4271 let v:errmsg = substitute(v:exception, '^Vim(throw):', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4272 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4273 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4274 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4275 call assert_match('E121: Undefined variable: novar', v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4276 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4277 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4278 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4279 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4280 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4281 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4282 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4283 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4284 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4285 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4286 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4287
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4288 func Test_catch_err_exception_3()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4289 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4290 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4291 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4292 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4293 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4294 throw "Vim:faked" " error: cannot fake Vim exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4295 catch /^Vim(throw):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4296 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4297 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4298 let v:errmsg = substitute(v:exception, '^Vim(throw):', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4299 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4300 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4301 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4302 call assert_match("E608: Cannot :throw exceptions with 'Vim' prefix",
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4303 \ v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4304 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4305 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4306 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4307 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4308 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4309 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4310 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4311 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4312 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4313 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4314 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4315
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4316 func Test_catch_err_exception_4()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4317 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4318 func F()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4319 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4320 " Missing :endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4321 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4322
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4323 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4324 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4325 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4326 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4327 call F()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4328 catch /^Vim(endfunction):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4329 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4330 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4331 let v:errmsg = substitute(v:exception, '^Vim(endfunction):', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4332 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4333 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4334 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4335 call assert_match("E170: Missing :endwhile", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4336 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4337 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4338 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4339 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4340 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4341 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4342 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4343 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4344 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4345 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4346 delfunc F
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4347 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4348
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4349 func Test_catch_err_exception_5()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4350 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4351 func F()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4352 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4353 " Missing :endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4354 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4355
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4356 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4357 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4358 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4359 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4360 ExecAsScript F
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4361 catch /^Vim:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4362 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4363 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4364 let v:errmsg = substitute(v:exception, '^Vim:', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4365 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4366 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4367 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4368 call assert_match("E170: Missing :endwhile", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4369 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4370 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4371 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4372 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4373 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4374 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4375 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4376 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4377 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4378 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4379 delfunc F
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4380 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4381
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4382 func Test_catch_err_exception_6()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4383 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4384 func G()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4385 call G()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4386 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4387
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4388 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4389 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4390 let mfd_save = &mfd
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4391 set mfd=3
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4392 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4393 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4394 call G()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4395 catch /^Vim(call):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4396 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4397 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4398 let v:errmsg = substitute(v:exception, '^Vim(call):', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4399 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4400 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4401 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4402 call assert_match("E132: Function call depth is higher than 'maxfuncdepth'", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4403 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4404 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4405 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4406 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4407 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4408 let &mfd = mfd_save
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4409 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4410 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4411 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4412 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4413 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4414 delfunc G
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4415 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4416
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4417 func Test_catch_err_exception_7()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4418 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4419 func H()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4420 return H()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4421 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4422
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4423 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4424 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4425 let mfd_save = &mfd
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4426 set mfd=3
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4427 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4428 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4429 call H()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4430 catch /^Vim(return):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4431 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4432 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4433 let v:errmsg = substitute(v:exception, '^Vim(return):', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4434 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4435 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4436 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4437 call assert_match("E132: Function call depth is higher than 'maxfuncdepth'", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4438 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4439 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4440 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4441 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4442 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4443 let &mfd = mfd_save
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4444 break " discard error for $VIMNOERRTHROW
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4445 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4446 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4447 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4448
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4449 call assert_equal('abc', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4450 delfunc H
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4451 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4452
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4453 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4454 " Test 63: Suppressing error exceptions by :silent!. {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4455 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4456 " A :silent! command inside a :try/:endtry region suppresses the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4457 " conversion of errors to an exception and the immediate abortion on
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4458 " error. When the commands executed by the :silent! themselves open
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4459 " a new :try/:endtry region, conversion of errors to exception and
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4460 " immediate abortion is switched on again - until the next :silent!
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4461 " etc. The :silent! has the effect of setting v:errmsg to the error
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4462 " message text (without displaying it) and continuing with the next
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4463 " script line.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4464 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4465 " When a command triggering autocommands is executed by :silent!
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4466 " inside a :try/:endtry, the autocommand execution is not suppressed
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4467 " on error.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4468 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4469 " This test reuses the function MSG() from the previous test.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4470 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4471
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4472 func Test_silent_exception()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4473 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4474 XloopINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4475 let g:taken = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4476
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4477 func S(n) abort
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4478 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4479 let g:taken = g:taken . "E" . a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4480 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4481 exec "asdf" . a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4482
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4483 " Check that ":silent!" continues:
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4484 Xloop 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4485
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4486 " Check that ":silent!" sets "v:errmsg":
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4487 call assert_match("E492: Not an editor command", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4488 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4489
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4490 func Foo()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4491 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4492 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4493 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4494 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4495 " This is not silent:
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4496 call S(3)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4497 catch /^Vim:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4498 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4499 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4500 let errmsg3 = substitute(v:exception, '^Vim:', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4501 silent! call S(4)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4502 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4503 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4504 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4505 call assert_match("E492: Not an editor command", errmsg3)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4506 silent! call S(5)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4507 " Break out of try conditionals that cover ":silent!". This also
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4508 " discards the aborting error when $VIMNOERRTHROW is non-zero.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4509 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4510 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4511 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4512 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4513 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4514 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4515 " This is a double ":silent!" (see caller).
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4516 silent! call S(6)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4517 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4518
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4519 func Bar()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4520 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4521 silent! call S(2)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4522 silent! execute "call Foo() | call S(7)"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4523 silent! call S(8)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4524 endtry " normal end of try cond that covers ":silent!"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4525 " This has a ":silent!" from the caller:
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4526 call S(9)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4527 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4528
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4529 silent! call S(1)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4530 silent! call Bar()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4531 silent! call S(10)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4532
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4533 call assert_equal("E1E2E3E4E5E6E7E8E9E10", g:taken)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4534
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4535 augroup TMP
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4536 au!
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4537 autocmd BufWritePost * Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4538 augroup END
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4539
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4540 Xpath 'e'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4541 silent! write /i/m/p/o/s/s/i/b/l/e
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4542 Xpath 'f'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4543
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4544 call assert_equal('a2a3ba5ca6a7a8a9a10a11edf', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4545
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4546 augroup TMP
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4547 au!
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4548 augroup END
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4549 augroup! TMP
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4550 delfunction S
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4551 delfunction Foo
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4552 delfunction Bar
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4553 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4554
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4555 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4556 " Test 64: Error exceptions after error, interrupt or :throw {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4557 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4558 " When an error occurs after an interrupt or a :throw but before
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4559 " a matching :catch is reached, all following :catches of that try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4560 " block are ignored, but the error exception can be caught by the next
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4561 " surrounding try conditional. Any previous error exception is
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4562 " discarded. An error is ignored when there is a previous error that
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4563 " has not been caught.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4564 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4565
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4566 func Test_exception_after_error_1()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4567 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4568 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4569 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4570 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4571 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4572 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4573 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4574 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4575 " Missing :endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4576 endwhile " throw error exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4577 catch /^Vim(/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4578 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4579 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4580 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4581 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4582 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4583 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4584 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4585 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4586 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4587 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4588 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4589 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4590 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4591 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4592 call assert_equal('abcd', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4593 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4594
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4595 func Test_exception_after_error_2()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4596 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4597 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4598 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4599 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4600 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4601 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4602 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4603 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4604 " Missing :endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4605 catch /.*/ " throw error exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4606 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4607 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4608 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4609 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4610 catch /^Vim(/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4611 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4612 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4613 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4614 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4615 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4616 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4617 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4618 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4619 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4620 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4621 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4622 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4623 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4624 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4625 call assert_equal('abcd', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4626 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4627
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4628 func Test_exception_after_error_3()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4629 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4630 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4631 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4632 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4633 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4634 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4635 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4636 call interrupt()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4637 catch /do_not_catch/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4638 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4639 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4640 " Missing :endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4641 catch /.*/ " throw error exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4642 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4643 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4644 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4645 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4646 catch /^Vim(/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4647 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4648 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4649 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4650 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4651 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4652 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4653 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4654 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4655 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4656 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4657 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4658 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4659 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4660 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4661 call assert_equal('abcd', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4662 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4663
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4664 func Test_exception_after_error_4()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4665 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4666 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4667 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4668 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4669 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4670 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4671 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4672 throw "x"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4673 catch /do_not_catch/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4674 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4675 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4676 " Missing :endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4677 catch /x/ " throw error exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4678 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4679 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4680 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4681 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4682 catch /^Vim(/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4683 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4684 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4685 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4686 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4687 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4688 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4689 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4690 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4691 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4692 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4693 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4694 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4695 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4696 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4697 call assert_equal('abcd', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4698 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4699
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4700 func Test_exception_after_error_5()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4701 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4702 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4703 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4704 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4705 let caught = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4706 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4707 endif " :endif without :if; throw error exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4708 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4709 " Missing :endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4710 catch /do_not_catch/ " ignore new error
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4711 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4712 catch /^Vim(endif):/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4713 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4714 let caught = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4715 catch /^Vim(/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4716 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4717 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4718 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4719 call assert_equal(1, caught)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4720 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4721 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4722 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4723 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4724 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4725 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4726 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4727 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4728 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4729 call assert_equal('abcd', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4730 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4731
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4732 "-------------------------------------------------------------------------------
21666
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4733 " 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
4734 "
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4735 " 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
4736 " 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
4737 " 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
4738 "-------------------------------------------------------------------------------
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4739
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4740 func Test_catch_pattern_error()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4741 CheckEnglish
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4742 XpathINIT
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4743
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4744 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4745 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4746 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4747 throw "oops"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4748 catch /^oops$/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4749 Xpath 'b'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4750 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
4751 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
4752 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4753 Xpath 'c'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4754 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4755 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
4756 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4757 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
4758
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4759 XpathINIT
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4760 func F()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4761 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4762 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4763 try
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4764 Xpath 'a'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4765 throw "ab"
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4766 catch /abc/ " does not catch
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4767 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
4768 catch /\)/ " error; discards exception
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4769 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
4770 catch /.*/ " not checked
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4771 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
4772 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4773 Xpath 'b'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4774 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4775 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
4776 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
4777 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
4778 catch /^Vim(catch):/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4779 Xpath 'c'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4780 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
4781 finally
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4782 Xpath 'd'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4783 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4784 Xpath 'e'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4785 catch /.*/
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4786 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
4787 endtry
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4788 Xpath 'f'
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4789 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4790
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4791 call F()
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4792 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
4793
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4794 delfunc F
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4795 endfunc
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4796
97b887aecd4a patch 8.2.1383: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21632
diff changeset
4797 "-------------------------------------------------------------------------------
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4798 " Test 66: Stop range :call on error, interrupt, or :throw {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4799 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4800 " When a function which is multiply called for a range since it
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4801 " doesn't handle the range itself has an error in a command
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4802 " dynamically enclosed by :try/:endtry or gets an interrupt or
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4803 " executes a :throw, no more calls for the remaining lines in the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4804 " range are made. On an error in a command not dynamically enclosed
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4805 " by :try/:endtry, the function is executed again for the remaining
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4806 " lines in the range.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4807 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4808
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4809 func Test_stop_range_on_error()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4810 let test =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4811 let file = tempname()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4812 exec "edit" file
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4813 call setline(1, ['line 1', 'line 2', 'line 3'])
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4814 let taken = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4815 let expected = "G1EF1E(1)F1E(2)F1E(3)G2EF2E(1)G3IF3I(1)G4TF4T(1)G5AF5A(1)"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4816
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4817 func F(reason, n) abort
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4818 let g:taken = g:taken .. "F" .. a:n ..
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4819 \ substitute(a:reason, '\(\l\).*', '\u\1', "") ..
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4820 \ "(" .. line(".") .. ")"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4821
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4822 if a:reason == "error"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4823 asdf
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4824 elseif a:reason == "interrupt"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4825 call interrupt()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4826 elseif a:reason == "throw"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4827 throw "xyz"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4828 elseif a:reason == "aborting error"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4829 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4830 call assert_equal(g:taken, g:expected)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4831 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4832 bwipeout!
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4833 call delete(g:file)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4834 asdf
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4835 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4836 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4837 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4838
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4839 func G(reason, n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4840 let g:taken = g:taken .. "G" .. a:n ..
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4841 \ substitute(a:reason, '\(\l\).*', '\u\1', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4842 1,3call F(a:reason, a:n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4843 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4844
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4845 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4846 call G("error", 1)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4847 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4848 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4849 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4850 call G("error", 2)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4851 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4852 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4853 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4854 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4855 call G("interrupt", 3)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4856 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4857 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4858 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4859 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4860 call G("throw", 4)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4861 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4862 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4863 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4864 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4865 catch /xyz/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4866 Xpath 'e'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4867 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4868 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4869 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4870 Xpath 'f'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4871 call G("aborting error", 5)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4872 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4873 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4874 let verify =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4875 call assert_equal('abcdef', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4876 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4877 call RunInNewVim(test, verify)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4878 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4879
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4880 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4881 " Test 67: :throw across :call command {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4882 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4883 " On a call command, an exception might be thrown when evaluating the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4884 " function name, during evaluation of the arguments, or when the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4885 " function is being executed. The exception can be caught by the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4886 " caller.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4887 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4888
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4889 func THROW(x, n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4890 if a:n == 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4891 Xpath 'A'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4892 elseif a:n == 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4893 Xpath 'B'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4894 elseif a:n == 3
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4895 Xpath 'C'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4896 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4897 throw a:x
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4898 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4899
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4900 func NAME(x, n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4901 if a:n == 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4902 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4903 elseif a:n == 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4904 Xpath 'D'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4905 elseif a:n == 3
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4906 Xpath 'E'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4907 elseif a:n == 4
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4908 Xpath 'F'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4909 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4910 return a:x
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4911 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4912
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4913 func ARG(x, n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4914 if a:n == 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4915 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4916 elseif a:n == 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4917 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4918 elseif a:n == 3
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4919 Xpath 'G'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4920 elseif a:n == 4
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4921 Xpath 'I'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4922 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4923 return a:x
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4924 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4925
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4926 func Test_throw_across_call_cmd()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4927 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4928
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4929 func F(x, n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4930 if a:n == 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4931 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4932 elseif a:n == 4
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4933 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4934 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4935 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4936
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4937 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4938 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4939 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4940
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4941 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4942 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4943 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4944 call {NAME(THROW("name", 1), 1)}(ARG(4711, 1), 1)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4945 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4946 catch /^name$/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4947 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4948 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4949 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4950 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4951 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4952 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4953 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4954 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4955 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4956
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4957 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4958 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4959 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4960 call {NAME("F", 2)}(ARG(THROW("arg", 2), 2), 2)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4961 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4962 catch /^arg$/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4963 Xpath 'e'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4964 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4965 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4966 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4967 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4968 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4969 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4970 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4971 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4972
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4973 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4974 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4975 Xpath 'f'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4976 call {NAME("THROW", 3)}(ARG("call", 3), 3)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4977 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4978 catch /^call$/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4979 Xpath 'g'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4980 catch /^0$/ " default return value
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4981 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4982 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4983 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4984 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4985 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4986 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4987 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4988 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4989 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4990
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4991 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4992 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4993 Xpath 'h'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4994 call {NAME("F", 4)}(ARG(4711, 4), 4)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4995 Xpath 'i'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4996 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4997 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4998 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
4999 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5000 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5001 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5002 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5003 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5004
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5005 catch /^0$/ " default return value
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5006 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5007 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5008 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5009 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5010 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5011 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5012 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5013 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5014 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5015
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5016 call assert_equal('bAcdDBefEGCghFIai', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5017 delfunction F
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5018 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5019
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5020 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5021 " Test 68: :throw across function calls in expressions {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5022 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5023 " On a function call within an expression, an exception might be
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5024 " thrown when evaluating the function name, during evaluation of the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5025 " arguments, or when the function is being executed. The exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5026 " can be caught by the caller.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5027 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5028 " This test reuses the functions THROW(), NAME(), and ARG() from the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5029 " previous test.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5030 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5031
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5032 func Test_throw_across_call_expr()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5033 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5034
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5035 func F(x, n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5036 if a:n == 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5037 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5038 elseif a:n == 4
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5039 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5040 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5041 return a:x
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5042 endfunction
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5043
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5044 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5045 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5046 let error = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5047 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5048
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5049 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5050 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5051 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5052 let var1 = {NAME(THROW("name", 1), 1)}(ARG(4711, 1), 1)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5053 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5054 catch /^name$/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5055 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5056 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5057 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5058 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5059 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5060 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5061 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5062 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5063 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5064 call assert_true(!exists('var1'))
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5065
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5066 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5067 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5068 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5069 let var2 = {NAME("F", 2)}(ARG(THROW("arg", 2), 2), 2)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5070 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5071 catch /^arg$/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5072 Xpath 'e'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5073 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5074 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5075 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5076 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5077 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5078 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5079 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5080 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5081 call assert_true(!exists('var2'))
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5082
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5083 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5084 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5085 Xpath 'f'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5086 let var3 = {NAME("THROW", 3)}(ARG("call", 3), 3)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5087 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5088 catch /^call$/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5089 Xpath 'g'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5090 catch /^0$/ " default return value
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5091 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5092 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5093 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5094 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5095 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5096 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5097 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5098 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5099 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5100 call assert_true(!exists('var3'))
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5101
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5102 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5103 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5104 Xpath 'h'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5105 let var4 = {NAME("F", 4)}(ARG(4711, 4), 4)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5106 Xpath 'i'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5107 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5108 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5109 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5110 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5111 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5112 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5113 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5114 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5115 call assert_true(exists('var4') && var4 == 4711)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5116
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5117 catch /^0$/ " default return value
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5118 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5119 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5120 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5121 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5122 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5123 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5124 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5125 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5126
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5127 call assert_equal('bAcdDBefEGCghFIai', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5128 delfunc F
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5129 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5130
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5131 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5132 " Test 76: Errors, interrupts, :throw during expression evaluation {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5133 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5134 " When a function call made during expression evaluation is aborted
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5135 " due to an error inside a :try/:endtry region or due to an interrupt
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5136 " or a :throw, the expression evaluation is aborted as well. No
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5137 " message is displayed for the cancelled expression evaluation. On an
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5138 " error not inside :try/:endtry, the expression evaluation continues.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5139 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5140
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5141 func Test_expr_eval_error()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5142 let test =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5143 let taken = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5144
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5145 func ERR(n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5146 let g:taken = g:taken .. "E" .. a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5147 asdf
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5148 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5149
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5150 func ERRabort(n) abort
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5151 let g:taken = g:taken .. "A" .. a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5152 asdf
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5153 endfunc " returns -1; may cause follow-up msg for illegal var/func name
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5154
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5155 func WRAP(n, arg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5156 let g:taken = g:taken .. "W" .. a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5157 let g:saved_errmsg = v:errmsg
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5158 return arg
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5159 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5160
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5161 func INT(n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5162 let g:taken = g:taken .. "I" .. a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5163 call interrupt()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5164 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5165
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5166 func THR(n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5167 let g:taken = g:taken .. "T" .. a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5168 throw "should not be caught"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5169 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5170
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5171 func CONT(n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5172 let g:taken = g:taken .. "C" .. a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5173 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5174
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5175 func MSG(n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5176 let g:taken = g:taken .. "M" .. a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5177 let errmsg = (a:n >= 37 && a:n <= 44) ? g:saved_errmsg : v:errmsg
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5178 let msgptn = (a:n >= 10 && a:n <= 27) ? "^$" : "asdf"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5179 call assert_match(msgptn, errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5180 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5181 let g:saved_errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5182 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5183
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5184 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5185
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5186 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5187 let t = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5188 while t <= 9
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5189 Xloop 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5190 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5191 if t == 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5192 let v{ERR(t) + CONT(t)} = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5193 elseif t == 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5194 let v{ERR(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5195 elseif t == 3
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5196 let var = exists('v{ERR(t) + CONT(t)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5197 elseif t == 4
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5198 unlet v{ERR(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5199 elseif t == 5
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5200 function F{ERR(t) + CONT(t)}()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5201 endfunction
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5202 elseif t == 6
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5203 function F{ERR(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5204 elseif t == 7
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5205 let var = exists('*F{ERR(t) + CONT(t)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5206 elseif t == 8
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5207 delfunction F{ERR(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5208 elseif t == 9
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5209 let var = ERR(t) + CONT(t)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5210 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5211 catch /asdf/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5212 " v:errmsg is not set when the error message is converted to an
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5213 " exception. Set it to the original error message.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5214 let v:errmsg = substitute(v:exception, '^Vim:', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5215 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5216 " An error exception has been thrown after the original error.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5217 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5218 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5219 call MSG(t)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5220 let t = t + 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5221 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5222 continue " discard an aborting error
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5223 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5224 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5225 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5226 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5227 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5228
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5229 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5230 let t = 10
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5231 while t <= 18
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5232 Xloop 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5233 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5234 if t == 10
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5235 let v{INT(t) + CONT(t)} = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5236 elseif t == 11
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5237 let v{INT(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5238 elseif t == 12
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5239 let var = exists('v{INT(t) + CONT(t)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5240 elseif t == 13
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5241 unlet v{INT(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5242 elseif t == 14
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5243 function F{INT(t) + CONT(t)}()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5244 endfunction
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5245 elseif t == 15
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5246 function F{INT(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5247 elseif t == 16
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5248 let var = exists('*F{INT(t) + CONT(t)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5249 elseif t == 17
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5250 delfunction F{INT(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5251 elseif t == 18
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5252 let var = INT(t) + CONT(t)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5253 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5254 catch /^Vim\((\a\+)\)\=:\(Interrupt\)\@!/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5255 " An error exception has been triggered after the interrupt.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5256 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5257 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5258 call MSG(t)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5259 let t = t + 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5260 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5261 continue " discard interrupt
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5262 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5263 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5264 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5265 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5266 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5267
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5268 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5269 let t = 19
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5270 while t <= 27
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5271 Xloop 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5272 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5273 if t == 19
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5274 let v{THR(t) + CONT(t)} = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5275 elseif t == 20
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5276 let v{THR(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5277 elseif t == 21
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5278 let var = exists('v{THR(t) + CONT(t)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5279 elseif t == 22
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5280 unlet v{THR(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5281 elseif t == 23
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5282 function F{THR(t) + CONT(t)}()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5283 endfunction
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5284 elseif t == 24
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5285 function F{THR(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5286 elseif t == 25
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5287 let var = exists('*F{THR(t) + CONT(t)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5288 elseif t == 26
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5289 delfunction F{THR(t) + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5290 elseif t == 27
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5291 let var = THR(t) + CONT(t)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5292 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5293 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5294 " An error exception has been triggered after the :throw.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5295 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5296 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5297 call MSG(t)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5298 let t = t + 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5299 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5300 continue " discard exception
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5301 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5302 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5303 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5304 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5305 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5306
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5307 let v{ERR(28) + CONT(28)} = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5308 call MSG(28)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5309 let v{ERR(29) + CONT(29)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5310 call MSG(29)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5311 let var = exists('v{ERR(30) + CONT(30)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5312 call MSG(30)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5313 unlet v{ERR(31) + CONT(31)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5314 call MSG(31)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5315 function F{ERR(32) + CONT(32)}()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5316 endfunction
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5317 call MSG(32)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5318 function F{ERR(33) + CONT(33)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5319 call MSG(33)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5320 let var = exists('*F{ERR(34) + CONT(34)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5321 call MSG(34)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5322 delfunction F{ERR(35) + CONT(35)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5323 call MSG(35)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5324 let var = ERR(36) + CONT(36)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5325 call MSG(36)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5326
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5327 let saved_errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5328
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5329 let v{WRAP(37, ERRabort(37)) + CONT(37)} = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5330 call MSG(37)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5331 let v{WRAP(38, ERRabort(38)) + CONT(38)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5332 call MSG(38)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5333 let var = exists('v{WRAP(39, ERRabort(39)) + CONT(39)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5334 call MSG(39)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5335 unlet v{WRAP(40, ERRabort(40)) + CONT(40)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5336 call MSG(40)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5337 function F{WRAP(41, ERRabort(41)) + CONT(41)}()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5338 endfunction
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5339 call MSG(41)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5340 function F{WRAP(42, ERRabort(42)) + CONT(42)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5341 call MSG(42)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5342 let var = exists('*F{WRAP(43, ERRabort(43)) + CONT(43)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5343 call MSG(43)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5344 delfunction F{WRAP(44, ERRabort(44)) + CONT(44)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5345 call MSG(44)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5346 let var = ERRabort(45) + CONT(45)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5347 call MSG(45)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5348 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5349
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5350 let expected = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5351 \ .. "E1M1E2M2E3M3E4M4E5M5E6M6E7M7E8M8E9M9"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5352 \ .. "I10M10I11M11I12M12I13M13I14M14I15M15I16M16I17M17I18M18"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5353 \ .. "T19M19T20M20T21M21T22M22T23M23T24M24T25M25T26M26T27M27"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5354 \ .. "E28C28M28E29C29M29E30C30M30E31C31M31E32C32M32E33C33M33"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5355 \ .. "E34C34M34E35C35M35E36C36M36"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5356 \ .. "A37W37C37M37A38W38C38M38A39W39C39M39A40W40C40M40A41W41C41M41"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5357 \ .. "A42W42C42M42A43W43C43M43A44W44C44M44A45C45M45"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5358 call assert_equal(expected, taken)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5359 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5360 let verify =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5361 let expected = "a1a2a3a4a5a6a7a8a9"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5362 \ .. "b10b11b12b13b14b15b16b17b18"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5363 \ .. "c19c20c21c22c23c24c25c26c27d"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5364 call assert_equal(expected, g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5365 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5366 call RunInNewVim(test, verify)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5367 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5368
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5369 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5370 " Test 77: Errors, interrupts, :throw in name{brace-expression} {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5371 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5372 " When a function call made during evaluation of an expression in
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5373 " braces as part of a function name after ":function" is aborted due
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5374 " to an error inside a :try/:endtry region or due to an interrupt or
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5375 " a :throw, the expression evaluation is aborted as well, and the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5376 " function definition is ignored, skipping all commands to the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5377 " ":endfunction". On an error not inside :try/:endtry, the expression
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5378 " evaluation continues and the function gets defined, and can be
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5379 " called and deleted.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5380 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5381 func Test_brace_expr_error()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5382 let test =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5383 func ERR() abort
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5384 Xloop 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5385 asdf
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5386 endfunc " returns -1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5387
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5388 func OK()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5389 Xloop 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5390 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5391 return 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5392 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5393
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5394 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5395
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5396 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5397 func F{1 + ERR() + OK()}(arg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5398 " F0 should be defined.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5399 if exists("a:arg") && a:arg == "calling"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5400 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5401 else
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5402 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5403 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5404 endfunction
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5405 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5406 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5407
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5408 Xpath 'e'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5409 call F{1 + ERR() + OK()}("calling")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5410 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5411 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5412
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5413 Xpath 'f'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5414 delfunction F{1 + ERR() + OK()}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5415 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5416 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5417
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5418 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5419 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5420 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5421 Xpath 'g'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5422 func G{1 + ERR() + OK()}(arg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5423 " G0 should not be defined, and the function body should be
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5424 " skipped.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5425 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5426 " Use an unmatched ":finally" to check whether the body is
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5427 " skipped when an error occurs in ERR(). This works whether or
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5428 " not the exception is converted to an exception.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5429 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5430 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5431 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5432 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5433 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5434 endfunction
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5435
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5436 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5437 catch /asdf/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5438 " Jumped to when the function is not defined and the body is
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5439 " skipped.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5440 Xpath 'h'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5441 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5442 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5443 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5444 Xpath 'i'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5445 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5446 endtry " jumped to when the body is not skipped
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5447 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5448 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5449 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5450 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5451 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5452 let verify =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5453 call assert_equal('ca1b1ea2b2dfa3b3ga4hi', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5454 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5455 call RunInNewVim(test, verify)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5456 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5457
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5458 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5459 " Test 78: Messages on parsing errors in expression evaluation {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5460 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5461 " When an expression evaluation detects a parsing error, an error
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5462 " message is given and converted to an exception, and the expression
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5463 " evaluation is aborted.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5464 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5465 func Test_expr_eval_error_msg()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5466 CheckEnglish
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5467
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5468 let test =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5469 let taken = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5470
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5471 func F(n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5472 let g:taken = g:taken . "F" . a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5473 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5474
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5475 func MSG(n, enr, emsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5476 let g:taken = g:taken . "M" . a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5477 call assert_match('^' .. a:enr .. ':', v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5478 call assert_match(a:emsg, v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5479 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5480
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5481 func CONT(n)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5482 let g:taken = g:taken . "C" . a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5483 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5484
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5485 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5486 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5487 let t = 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5488 while t <= 14
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5489 let g:taken = g:taken . "T" . t
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5490 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5491 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5492 if t == 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5493 let v{novar + CONT(t)} = 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5494 elseif t == 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5495 let v{novar + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5496 elseif t == 3
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5497 let var = exists('v{novar + CONT(t)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5498 elseif t == 4
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5499 unlet v{novar + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5500 elseif t == 5
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5501 function F{novar + CONT(t)}()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5502 endfunction
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5503 elseif t == 6
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5504 function F{novar + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5505 elseif t == 7
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5506 let var = exists('*F{novar + CONT(t)}')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5507 elseif t == 8
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5508 delfunction F{novar + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5509 elseif t == 9
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5510 echo novar + CONT(t)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5511 elseif t == 10
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5512 echo v{novar + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5513 elseif t == 11
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5514 echo F{novar + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5515 elseif t == 12
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5516 let var = novar + CONT(t)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5517 elseif t == 13
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5518 let var = v{novar + CONT(t)}
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5519 elseif t == 14
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5520 let var = F{novar + CONT(t)}()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5521 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5522 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5523 Xloop 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5524 " v:errmsg is not set when the error message is converted to an
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5525 " exception. Set it to the original error message.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5526 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5527 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5528 Xloop 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5529 if t <= 8 && t != 3 && t != 7
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5530 call MSG(t, 'E475', 'Invalid argument\>')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5531 else
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5532 call MSG(t, 'E121', "Undefined variable")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5533 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5534 let t = t + 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5535 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5536 continue " discard an aborting error
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5537 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5538 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5539 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5540 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5541 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5542
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5543 func T(n, expr, enr, emsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5544 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5545 let g:taken = g:taken . "T" . a:n
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5546 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5547 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5548 execute "let var = " . a:expr
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5549 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5550 Xloop 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5551 " v:errmsg is not set when the error message is converted to an
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5552 " exception. Set it to the original error message.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5553 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5554 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5555 Xloop 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5556 call MSG(a:n, a:enr, a:emsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5557 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5558 " Discard an aborting error:
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5559 return
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5560 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5561 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5562 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5563 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5564 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5565
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5566 call T(15, 'Nofunc() + CONT(15)', 'E117', "Unknown function")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5567 call T(16, 'F(1 2 + CONT(16))', 'E116', "Invalid arguments")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5568 call T(17, 'F(1, 2) + CONT(17)', 'E118', "Too many arguments")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5569 call T(18, 'F() + CONT(18)', 'E119', "Not enough arguments")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5570 call T(19, '{(1} + CONT(19)', 'E110', "Missing ')'")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5571 call T(20, '("abc"[1) + CONT(20)', 'E111', "Missing ']'")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5572 call T(21, '(1 +) + CONT(21)', 'E15', "Invalid expression")
24958
21ec48d542a8 patch 8.2.3016: confusing error when expression is followed by comma
Bram Moolenaar <Bram@vim.org>
parents: 24862
diff changeset
5573 call T(22, '1 2 + CONT(22)', 'E488', "Trailing characters: 2 +")
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5574 call T(23, '(1 ? 2) + CONT(23)', 'E109', "Missing ':' after '?'")
26606
c40554dfe03e patch 8.2.3832: test fails because of changed error message
Bram Moolenaar <Bram@vim.org>
parents: 25615
diff changeset
5575 call T(24, '("abc) + CONT(24)', 'E114', "Missing double quote")
c40554dfe03e patch 8.2.3832: test fails because of changed error message
Bram Moolenaar <Bram@vim.org>
parents: 25615
diff changeset
5576 call T(25, "('abc) + CONT(25)", 'E115', "Missing single quote")
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5577 call T(26, '& + CONT(26)', 'E112', "Option name missing")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5578 call T(27, '&asdf + CONT(27)', 'E113', "Unknown option")
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5579
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5580 let expected = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5581 \ .. "T1M1T2M2T3M3T4M4T5M5T6M6T7M7T8M8T9M9T10M10T11M11T12M12T13M13T14M14"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5582 \ .. "T15M15T16M16T17M17T18M18T19M19T20M20T21M21T22M22T23M23T24M24T25M25"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5583 \ .. "T26M26T27M27"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5584
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5585 call assert_equal(expected, taken)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5586 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5587 let verify =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5588 let expected = "a1b1a2b2a3b3a4b4a5b5a6b6a7b7a8b8a9b9a10b10a11b11a12b12"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5589 \ .. "a13b13a14b14c15d15c16d16c17d17c18d18c19d19c20d20"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5590 \ .. "c21d21c22d22c23d23c24d24c25d25c26d26c27d27"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5591 call assert_equal(expected, g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5592 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5593 call RunInNewVim(test, verify)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5594 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5595
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5596 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5597 " Test 79: Throwing one of several errors for the same command {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5598 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5599 " When several errors appear in a row (for instance during expression
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5600 " evaluation), the first as the most specific one is used when
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5601 " throwing an error exception. If, however, a syntax error is
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5602 " detected afterwards, this one is used for the error exception.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5603 " On a syntax error, the next command is not executed, on a normal
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5604 " error, however, it is (relevant only in a function without the
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5605 " "abort" flag). v:errmsg is not set.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5606 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5607 " If throwing error exceptions is configured off, v:errmsg is always
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5608 " set to the latest error message, that is, to the more general
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5609 " message or the syntax error, respectively.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5610 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5611 func Test_throw_multi_error()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5612 CheckEnglish
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5613
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5614 let test =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5615 func NEXT(cmd)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5616 exec a:cmd . " | Xloop 'a'"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5617 endfun
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5618
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5619 call NEXT('echo novar') " (checks nextcmd)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5620 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5621 call NEXT('let novar #') " (skips nextcmd)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5622 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5623 call NEXT('unlet novar #') " (skips nextcmd)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5624 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5625 call NEXT('let {novar}') " (skips nextcmd)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5626 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5627 call NEXT('unlet{ novar}') " (skips nextcmd)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5628
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5629 call assert_equal('a1', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5630 XpathINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5631 XloopINIT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5632
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5633 func EXEC(cmd)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5634 exec a:cmd
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5635 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5636
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5637 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5638 while 1 " dummy loop
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5639 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5640 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5641 call EXEC('echo novar') " normal error
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5642 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5643 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5644 call assert_match('E121: Undefined variable: novar', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5645 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5646 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5647 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5648 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5649 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5650 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5651
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5652 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5653 let cmd = "let"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5654 while cmd != ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5655 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5656 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5657 call EXEC(cmd . ' novar #') " normal plus syntax error
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5658 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5659 Xloop 'e'
25615
b0f82974ddf4 patch 8.2.3344: vimscript test fails
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
5660 if cmd =~ 'unlet'
b0f82974ddf4 patch 8.2.3344: vimscript test fails
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
5661 " TODO: should get error for 'novar'
b0f82974ddf4 patch 8.2.3344: vimscript test fails
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
5662 call assert_match('E488: Trailing characters', v:exception)
b0f82974ddf4 patch 8.2.3344: vimscript test fails
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
5663 else
b0f82974ddf4 patch 8.2.3344: vimscript test fails
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
5664 call assert_match('E121: Undefined variable: novar', v:exception)
b0f82974ddf4 patch 8.2.3344: vimscript test fails
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
5665 endif
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5666 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5667 Xloop 'f'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5668 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5669 if cmd == "let"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5670 let cmd = "unlet"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5671 else
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5672 let cmd = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5673 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5674 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5675 continue
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5676 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5677 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5678
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5679 Xpath 'g'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5680 let cmd = "let"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5681 while cmd != ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5682 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5683 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5684 call EXEC(cmd . ' {novar}') " normal plus syntax error
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5685 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5686 Xloop 'h'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5687 call assert_match('E475: Invalid argument: {novar}', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5688 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5689 Xloop 'i'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5690 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5691 if cmd == "let"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5692 let cmd = "unlet"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5693 else
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5694 let cmd = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5695 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5696 XloopNEXT
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5697 continue
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5698 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5699 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5700 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5701 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5702 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5703 Xpath 'j'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5704 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5705 let verify =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5706 call assert_equal('bcde1f1e2f2gh3i3h4i4j', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5707 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5708 call RunInNewVim(test, verify)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5709 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5710
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5711 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5712 " Test 80: Syntax error in expression for illegal :elseif {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5713 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5714 " If there is a syntax error in the expression after an illegal
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5715 " :elseif, an error message is given (or an error exception thrown)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5716 " for the illegal :elseif rather than the expression error.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5717 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5718 func Test_if_syntax_error()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5719 CheckEnglish
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5720
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5721 let test =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5722 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5723 if 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5724 else
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5725 elseif 1 ||| 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5726 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5727 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5728 call assert_match('E584: :elseif after :else', v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5729
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5730 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5731 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5732 else
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5733 elseif 1 ||| 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5734 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5735 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5736 call assert_match('E584: :elseif after :else', v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5737
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5738 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5739 elseif 1 ||| 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5740 Xpath 'c'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5741 call assert_match('E582: :elseif without :if', v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5742
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5743 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5744 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5745 elseif 1 ||| 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5746 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5747 Xpath 'd'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5748 call assert_match('E582: :elseif without :if', v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5749
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5750 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5751 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5752 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5753 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5754 if 0
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5755 else
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5756 elseif 1 ||| 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5757 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5758 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5759 Xpath 'e'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5760 call assert_match('E584: :elseif after :else', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5761 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5762 Xpath 'f'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5763 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5764 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5765 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5766 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5767 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5768 Xpath 'g'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5769 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5770 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5771 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5772
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5773 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5774 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5775 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5776 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5777 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5778 else
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5779 elseif 1 ||| 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5780 endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5781 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5782 Xpath 'h'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5783 call assert_match('E584: :elseif after :else', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5784 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5785 Xpath 'i'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5786 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5787 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5788 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5789 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5790 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5791 Xpath 'j'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5792 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5793 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5794 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5795
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5796 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5797 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5798 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5799 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5800 elseif 1 ||| 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5801 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5802 Xpath 'k'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5803 call assert_match('E582: :elseif without :if', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5804 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5805 Xpath 'l'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5806 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5807 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5808 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5809 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5810 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5811 Xpath 'm'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5812 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5813 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5814 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5815
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5816 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5817 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5818 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5819 let v:errmsg = ""
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5820 while 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5821 elseif 1 ||| 2
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5822 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5823 catch /^Vim\((\a\+)\)\=:/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5824 Xpath 'n'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5825 call assert_match('E582: :elseif without :if', v:exception)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5826 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5827 Xpath 'o'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5828 call assert_equal("", v:errmsg)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5829 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5830 catch /.*/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5831 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5832 finally
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5833 Xpath 'p'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5834 break
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5835 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5836 endwhile
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5837 Xpath 'q'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5838 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5839 let verify =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5840 call assert_equal('abcdefghijklmnopq', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5841 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5842 call RunInNewVim(test, verify)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5843 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5844
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5845 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5846 " Test 81: Discarding exceptions after an error or interrupt {{{1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5847 "
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5848 " When an exception is thrown from inside a :try conditional without
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5849 " :catch and :finally clauses and an error or interrupt occurs before
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5850 " the :endtry is reached, the exception is discarded.
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5851 "-------------------------------------------------------------------------------
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5852
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5853 func Test_discard_exception_after_error_1()
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5854 let test =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5855 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5856 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5857 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5858 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5859 throw "arrgh"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5860 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5861 if 1
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5862 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5863 " error after :throw: missing :endif
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5864 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5865 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5866 catch /arrgh/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5867 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5868 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5869 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5870 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5871 let verify =<< trim [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5872 call assert_equal('ab', g:Xpath)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5873 [CODE]
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5874 call RunInNewVim(test, verify)
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5875 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5876
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5877 " interrupt the code before the endtry is invoked
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5878 func Test_discard_exception_after_error_2()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5879 XpathINIT
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5880 let lines =<< trim [CODE]
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5881 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5882 Xpath 'a'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5883 try
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5884 Xpath 'b'
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5885 throw "arrgh"
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5886 call assert_report('should not get here')
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5887 endtry " interrupt here
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5888 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5889 catch /arrgh/
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5890 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5891 endtry
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5892 call assert_report('should not get here')
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5893 [CODE]
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5894 call writefile(lines, 'Xscript')
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5895
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5896 breakadd file 7 Xscript
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5897 try
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5898 let caught_intr = 0
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5899 debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5900 call feedkeys(":source Xscript\<CR>quit\<CR>", "xt")
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5901 catch /^Vim:Interrupt$/
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5902 call assert_match('Xscript, line 7', v:throwpoint)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5903 let caught_intr = 1
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5904 endtry
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5905 0debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5906 call assert_equal(1, caught_intr)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5907 call assert_equal('ab', g:Xpath)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5908 breakdel *
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5909 call delete('Xscript')
21735
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5910 endfunc
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5911
078d98fe1c65 patch 8.2.1417: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21666
diff changeset
5912 "-------------------------------------------------------------------------------
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5913 " Test 82: Ignoring :catch clauses after an error or interrupt {{{1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5914 "
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5915 " When an exception is thrown and an error or interrupt occurs before
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5916 " the matching :catch clause is reached, the exception is discarded
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5917 " and the :catch clause is ignored (also for the error or interrupt
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5918 " exception being thrown then).
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5919 "-------------------------------------------------------------------------------
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5920
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5921 func Test_ignore_catch_after_error_1()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5922 let test =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5923 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5924 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5925 Xpath 'a'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5926 throw "arrgh"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5927 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5928 if 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5929 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5930 " error after :throw: missing :endif
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5931 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5932 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5933 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5934 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5935 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5936 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5937 catch /arrgh/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5938 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5939 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5940 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5941 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5942 let verify =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5943 call assert_equal('a', g:Xpath)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5944 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5945 call RunInNewVim(test, verify)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5946 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5947
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5948 func Test_ignore_catch_after_error_2()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5949 let test =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5950 func E()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5951 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5952 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5953 Xpath 'a'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5954 throw "arrgh"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5955 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5956 if 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5957 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5958 " error after :throw: missing :endif
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5959 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5960 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5961 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5962 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5963 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5964 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5965 catch /arrgh/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5966 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5967 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5968 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5969
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5970 call E()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5971 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5972 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5973 let verify =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5974 call assert_equal('a', g:Xpath)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5975 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5976 call RunInNewVim(test, verify)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5977 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5978
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5979 " interrupt right before a catch is invoked in a script
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5980 func Test_ignore_catch_after_intr_1()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5981 XpathINIT
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5982 let lines =<< trim [CODE]
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5983 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5984 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5985 Xpath 'a'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5986 throw "arrgh"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5987 call assert_report('should not get here')
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5988 catch /.*/ " interrupt here
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5989 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5990 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5991 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5992 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5993 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5994 catch /arrgh/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5995 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5996 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5997 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
5998 [CODE]
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
5999 call writefile(lines, 'Xscript')
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6000
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6001 breakadd file 6 Xscript
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6002 try
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6003 let caught_intr = 0
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6004 debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6005 call feedkeys(":source Xscript\<CR>quit\<CR>", "xt")
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6006 catch /^Vim:Interrupt$/
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6007 call assert_match('Xscript, line 6', v:throwpoint)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6008 let caught_intr = 1
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6009 endtry
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6010 0debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6011 call assert_equal(1, caught_intr)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6012 call assert_equal('a', g:Xpath)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6013 breakdel *
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6014 call delete('Xscript')
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6015 endfunc
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6016
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6017 " interrupt right before a catch is invoked inside a function.
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6018 func Test_ignore_catch_after_intr_2()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6019 XpathINIT
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6020 func F()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6021 try
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6022 try
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6023 Xpath 'a'
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6024 throw "arrgh"
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6025 call assert_report('should not get here')
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6026 catch /.*/ " interrupt here
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6027 call assert_report('should not get here')
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6028 catch /.*/
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6029 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6030 endtry
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6031 call assert_report('should not get here')
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6032 catch /arrgh/
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6033 call assert_report('should not get here')
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6034 endtry
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6035 call assert_report('should not get here')
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6036 endfunc
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6037
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6038 breakadd func 6 F
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6039 try
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6040 let caught_intr = 0
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6041 debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6042 call feedkeys(":call F()\<CR>quit\<CR>", "xt")
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6043 catch /^Vim:Interrupt$/
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6044 call assert_match('\.F, line 6', v:throwpoint)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6045 let caught_intr = 1
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6046 endtry
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6047 0debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6048 call assert_equal(1, caught_intr)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6049 call assert_equal('a', g:Xpath)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6050 breakdel *
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6051 delfunc F
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6052 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6053
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6054 "-------------------------------------------------------------------------------
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6055 " Test 83: Executing :finally clauses after an error or interrupt {{{1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6056 "
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6057 " When an exception is thrown and an error or interrupt occurs before
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6058 " the :finally of the innermost :try is reached, the exception is
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6059 " discarded and the :finally clause is executed.
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6060 "-------------------------------------------------------------------------------
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6061
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6062 func Test_finally_after_error()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6063 let test =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6064 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6065 Xpath 'a'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6066 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6067 Xpath 'b'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6068 throw "arrgh"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6069 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6070 if 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6071 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6072 " error after :throw: missing :endif
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6073 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6074 Xpath 'c'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6075 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6076 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6077 catch /arrgh/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6078 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6079 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6080 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6081 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6082 let verify =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6083 call assert_equal('abc', g:Xpath)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6084 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6085 call RunInNewVim(test, verify)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6086 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6087
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6088 " interrupt the code right before the finally is invoked
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6089 func Test_finally_after_intr()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6090 XpathINIT
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6091 let lines =<< trim [CODE]
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6092 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6093 Xpath 'a'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6094 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6095 Xpath 'b'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6096 throw "arrgh"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6097 call assert_report('should not get here')
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6098 finally " interrupt here
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6099 Xpath 'c'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6100 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6101 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6102 catch /arrgh/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6103 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6104 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6105 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6106 [CODE]
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6107 call writefile(lines, 'Xscript')
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6108
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6109 breakadd file 7 Xscript
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6110 try
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6111 let caught_intr = 0
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6112 debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6113 call feedkeys(":source Xscript\<CR>quit\<CR>", "xt")
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6114 catch /^Vim:Interrupt$/
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6115 call assert_match('Xscript, line 7', v:throwpoint)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6116 let caught_intr = 1
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6117 endtry
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6118 0debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6119 call assert_equal(1, caught_intr)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6120 call assert_equal('abc', g:Xpath)
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6121 breakdel *
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
6122 call delete('Xscript')
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6123 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6124
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6125 "-------------------------------------------------------------------------------
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6126 " Test 84: Exceptions in autocommand sequences. {{{1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6127 "
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6128 " When an exception occurs in a sequence of autocommands for
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6129 " a specific event, the rest of the sequence is not executed. The
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6130 " command that triggered the autocommand execution aborts, and the
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6131 " exception is propagated to the caller.
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6132 "
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6133 " For the FuncUndefined event under a function call expression or
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6134 " :call command, the function is not executed, even when it has
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6135 " been defined by the autocommands before the exception occurred.
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6136 "-------------------------------------------------------------------------------
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6137
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6138 func Test_autocmd_exception()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6139 let test =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6140 func INT()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6141 call interrupt()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6142 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6143
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6144 aug TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6145 autocmd!
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6146
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6147 autocmd User x1 Xpath 'a'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6148 autocmd User x1 throw "x1"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6149 autocmd User x1 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6150
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6151 autocmd User x2 Xpath 'b'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6152 autocmd User x2 asdf
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6153 autocmd User x2 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6154
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6155 autocmd User x3 Xpath 'c'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6156 autocmd User x3 call INT()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6157 autocmd User x3 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6158
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6159 autocmd FuncUndefined U1 func U1()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6160 autocmd FuncUndefined U1 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6161 autocmd FuncUndefined U1 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6162 autocmd FuncUndefined U1 Xpath 'd'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6163 autocmd FuncUndefined U1 throw "U1"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6164 autocmd FuncUndefined U1 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6165
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6166 autocmd FuncUndefined U2 func U2()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6167 autocmd FuncUndefined U2 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6168 autocmd FuncUndefined U2 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6169 autocmd FuncUndefined U2 Xpath 'e'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6170 autocmd FuncUndefined U2 ASDF
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6171 autocmd FuncUndefined U2 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6172
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6173 autocmd FuncUndefined U3 func U3()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6174 autocmd FuncUndefined U3 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6175 autocmd FuncUndefined U3 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6176 autocmd FuncUndefined U3 Xpath 'f'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6177 autocmd FuncUndefined U3 call INT()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6178 autocmd FuncUndefined U3 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6179 aug END
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6180
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6181 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6182 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6183 Xpath 'g'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6184 doautocmd User x1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6185 catch /x1/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6186 Xpath 'h'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6187 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6188
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6189 while 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6190 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6191 Xpath 'i'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6192 doautocmd User x2
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6193 catch /asdf/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6194 Xpath 'j'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6195 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6196 Xpath 'k'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6197 break
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6198 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6199 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6200
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6201 while 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6202 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6203 Xpath 'l'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6204 doautocmd User x3
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6205 catch /Vim:Interrupt/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6206 Xpath 'm'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6207 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6208 Xpath 'n'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6209 " ... but break loop for caught interrupt exception,
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6210 " or discard interrupt and break loop if $VIMNOINTTHROW
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6211 break
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6212 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6213 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6214
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6215 if exists("*U1") | delfunction U1 | endif
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6216 if exists("*U2") | delfunction U2 | endif
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6217 if exists("*U3") | delfunction U3 | endif
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6218
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6219 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6220 Xpath 'o'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6221 call U1()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6222 catch /U1/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6223 Xpath 'p'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6224 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6225
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6226 while 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6227 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6228 Xpath 'q'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6229 call U2()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6230 catch /ASDF/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6231 Xpath 'r'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6232 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6233 Xpath 's'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6234 " ... but break loop for caught error exception,
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6235 " or discard error and break loop if $VIMNOERRTHROW
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6236 break
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6237 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6238 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6239
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6240 while 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6241 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6242 Xpath 't'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6243 call U3()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6244 catch /Vim:Interrupt/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6245 Xpath 'u'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6246 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6247 Xpath 'v'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6248 " ... but break loop for caught interrupt exception,
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6249 " or discard interrupt and break loop if $VIMNOINTTHROW
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6250 break
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6251 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6252 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6253 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6254 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6255 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6256 Xpath 'w'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6257 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6258 let verify =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6259 call assert_equal('gahibjklcmnodpqerstfuvw', g:Xpath)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6260 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6261 call RunInNewVim(test, verify)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6262 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6263
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6264 "-------------------------------------------------------------------------------
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6265 " Test 85: Error exceptions in autocommands for I/O command events {{{1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6266 "
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6267 " When an I/O command is inside :try/:endtry, autocommands to be
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6268 " executed after it should be skipped on an error (exception) in the
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6269 " command itself or in autocommands to be executed before the command.
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6270 " In the latter case, the I/O command should not be executed either.
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6271 " Example 1: BufWritePre, :write, BufWritePost
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6272 " Example 2: FileReadPre, :read, FileReadPost.
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6273 "-------------------------------------------------------------------------------
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6274
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6275 func Test_autocmd_error_io_exception()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6276 let test =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6277 " Remove the autocommands for the events specified as arguments in all used
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6278 " autogroups.
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6279 func Delete_autocommands(...)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6280 let augfile = tempname()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6281 while 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6282 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6283 exec "redir >" . augfile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6284 aug
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6285 redir END
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6286 exec "edit" augfile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6287 g/^$/d
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6288 norm G$
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6289 let wrap = "w"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6290 while search('\%( \|^\)\@<=.\{-}\%( \)\@=', wrap) > 0
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6291 let wrap = "W"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6292 exec "norm y/ \n"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6293 let argno = 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6294 while argno <= a:0
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6295 exec "au!" escape(@", " ") a:{argno}
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6296 let argno = argno + 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6297 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6298 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6299 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6300 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6301 bwipeout!
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6302 call delete(augfile)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6303 break
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6304 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6305 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6306 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6307
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6308 call Delete_autocommands("BufWritePre", "BufWritePost")
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6309
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6310 while 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6311 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6312 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6313 let post = 0
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6314 aug TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6315 au! BufWritePost * let post = 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6316 aug END
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6317 write /n/o/n/e/x/i/s/t/e/n/t
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6318 catch /^Vim(write):/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6319 Xpath 'a'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6320 call assert_match("E212: Can't open file for writing", v:exception)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6321 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6322 Xpath 'b'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6323 call assert_equal(0, post)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6324 au! TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6325 aug! TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6326 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6327 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6328 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6329 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6330 Xpath 'c'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6331 break
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6332 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6333 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6334
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6335 while 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6336 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6337 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6338 let post = 0
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6339 aug TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6340 au! BufWritePre * asdf
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6341 au! BufWritePost * let post = 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6342 aug END
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6343 let tmpfile = tempname()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6344 exec "write" tmpfile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6345 catch /^Vim\((write)\)\=:/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6346 Xpath 'd'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6347 call assert_match('E492: Not an editor command', v:exception)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6348 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6349 Xpath 'e'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6350 if filereadable(tmpfile)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6351 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6352 endif
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6353 call assert_equal(0, post)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6354 au! TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6355 aug! TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6356 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6357 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6358 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6359 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6360 Xpath 'f'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6361 break
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6362 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6363 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6364
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6365 call delete(tmpfile)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6366
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6367 call Delete_autocommands("BufWritePre", "BufWritePost",
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6368 \ "BufReadPre", "BufReadPost", "FileReadPre", "FileReadPost")
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6369
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6370 while 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6371 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6372 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6373 let post = 0
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6374 aug TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6375 au! FileReadPost * let post = 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6376 aug END
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6377 let caught = 0
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6378 read /n/o/n/e/x/i/s/t/e/n/t
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6379 catch /^Vim(read):/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6380 Xpath 'g'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6381 call assert_match("E484: Can't open file", v:exception)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6382 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6383 Xpath 'h'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6384 call assert_equal(0, post)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6385 au! TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6386 aug! TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6387 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6388 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6389 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6390 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6391 Xpath 'i'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6392 break
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6393 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6394 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6395
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6396 while 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6397 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6398 let infile = tempname()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6399 let tmpfile = tempname()
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6400 call writefile(["XYZ"], infile)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6401 exec "edit" tmpfile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6402 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6403 Xpath 'j'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6404 try
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6405 let post = 0
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6406 aug TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6407 au! FileReadPre * asdf
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6408 au! FileReadPost * let post = 1
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6409 aug END
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6410 exec "0read" infile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6411 catch /^Vim\((read)\)\=:/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6412 Xpath 'k'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6413 call assert_match('E492: Not an editor command', v:exception)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6414 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6415 Xpath 'l'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6416 if getline("1") == "XYZ"
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6417 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6418 endif
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6419 call assert_equal(0, post)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6420 au! TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6421 aug! TMP
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6422 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6423 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6424 Xpath 'm'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6425 bwipeout!
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6426 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6427 catch /.*/
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6428 call assert_report('should not get here')
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6429 finally
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6430 Xpath 'n'
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6431 break
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6432 endtry
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6433 endwhile
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6434
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6435 call delete(infile)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6436 call delete(tmpfile)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6437 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6438 let verify =<< trim [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6439 call assert_equal('abcdefghijklmn', g:Xpath)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6440 [CODE]
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6441 call RunInNewVim(test, verify)
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6442 endfunc
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6443
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21735
diff changeset
6444 "-------------------------------------------------------------------------------
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6445 " 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
6446 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6447 " 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
6448 " 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
6449 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6450
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6451 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
6452 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
6453 endfu
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6454
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6455 func GetStr()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6456 return "abcdefghijklmnopqrstuvwxyp"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6457 endfu
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6458
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6459 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
6460 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
6461
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6462 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
6463 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
6464 " 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
6465 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
6466 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
6467
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6468 " 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
6469 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6470
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6471 func Test_curlies()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6472 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
6473 let ns = 's'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6474 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
6475
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6476 let g:a = {}
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6477 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
6478 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
6479 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
6480 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6481
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6482 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6483 " 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
6484 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6485
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6486 func Test_type()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6487 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
6488 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
6489 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
6490 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
6491 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
6492 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
6493 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
6494 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
6495 endif
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6496 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
6497 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
6498 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
6499 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
6500 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
6501 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
6502 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
6503 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
6504 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
6505 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
6506 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
6507 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
6508 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
6509 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
6510 endif
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6511 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
6512 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
6513 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
6514 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
6515 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
6516 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
6517 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
6518 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
6519 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
6520 if has('job')
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20128
diff changeset
6521 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
6522 endif
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20128
diff changeset
6523 if has('channel')
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20128
diff changeset
6524 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
6525 endif
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20128
diff changeset
6526 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
6527
19548
9a9ca0e622c8 patch 8.2.0331: internal error when using test_void() and test_unknown()
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
6528 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
6529 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
6530
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6531 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
6532 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
6533 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
6534 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
6535
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6536 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
6537 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
6538 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
6539 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
6540
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6541 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
6542 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
6543 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
6544 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
6545 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
6546 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
6547
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6548 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
6549 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
6550 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
6551 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
6552
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6553 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
6554 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
6555 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
6556 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
6557
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6558 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
6559 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
6560 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
6561 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
6562
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6563 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
6564 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
6565 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
6566 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
6567 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
6568 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
6569
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6570 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
6571 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
6572 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
6573 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
6574 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
6575 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
6576
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6577 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
6578 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
6579 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
6580 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
6581
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6582 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
6583 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
6584 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
6585 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
6586
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6587 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
6588 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
6589 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
6590 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
6591
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6592 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
6593 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
6594 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
6595 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
6596
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6597 func ChangeYourMind()
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6598 try
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6599 return v:true
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6600 finally
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6601 return 'something else'
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6602 endtry
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6603 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6604
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6605 call ChangeYourMind()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6606 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6607
23594
d3e064f54890 patch 8.2.2339: cannot get the type of a value as a string
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
6608 func Test_typename()
d3e064f54890 patch 8.2.2339: cannot get the type of a value as a string
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
6609 call assert_equal('number', typename(123))
d3e064f54890 patch 8.2.2339: cannot get the type of a value as a string
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
6610 call assert_equal('string', typename('x'))
d3e064f54890 patch 8.2.2339: cannot get the type of a value as a string
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
6611 call assert_equal('list<number>', typename([123]))
d3e064f54890 patch 8.2.2339: cannot get the type of a value as a string
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
6612 call assert_equal('dict<number>', typename(#{key: 123}))
d3e064f54890 patch 8.2.2339: cannot get the type of a value as a string
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
6613 call assert_equal('list<dict<number>>', typename([#{key: 123}]))
24160
e695db9a5465 patch 8.2.2621: typval2type() cannot handle recursive structures
Bram Moolenaar <Bram@vim.org>
parents: 23594
diff changeset
6614
e695db9a5465 patch 8.2.2621: typval2type() cannot handle recursive structures
Bram Moolenaar <Bram@vim.org>
parents: 23594
diff changeset
6615 let l = []
e695db9a5465 patch 8.2.2621: typval2type() cannot handle recursive structures
Bram Moolenaar <Bram@vim.org>
parents: 23594
diff changeset
6616 let d = #{a: 0}
e695db9a5465 patch 8.2.2621: typval2type() cannot handle recursive structures
Bram Moolenaar <Bram@vim.org>
parents: 23594
diff changeset
6617 let l = [d]
e695db9a5465 patch 8.2.2621: typval2type() cannot handle recursive structures
Bram Moolenaar <Bram@vim.org>
parents: 23594
diff changeset
6618 let l[0].e = #{b: l}
e695db9a5465 patch 8.2.2621: typval2type() cannot handle recursive structures
Bram Moolenaar <Bram@vim.org>
parents: 23594
diff changeset
6619 call assert_equal('list<dict<any>>', typename(l))
e695db9a5465 patch 8.2.2621: typval2type() cannot handle recursive structures
Bram Moolenaar <Bram@vim.org>
parents: 23594
diff changeset
6620 call assert_equal('dict<any>', typename(d))
23594
d3e064f54890 patch 8.2.2339: cannot get the type of a value as a string
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
6621 endfunc
d3e064f54890 patch 8.2.2339: cannot get the type of a value as a string
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
6622
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6623 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6624 " 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
6625 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6626
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6627 func Test_skip()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6628 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
6629 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
6630 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
6631 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
6632 let l = []
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6633 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
6634 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
6635 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
6636 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
6637 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
6638 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
6639 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
6640 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
6641 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
6642 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
6643 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
6644
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6645 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6646
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6647 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6648 " 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
6649 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6650
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6651 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
6652 " String
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6653 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
6654 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6655 echo a
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6656 echo string(a)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6657 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6658 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
6659 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
6660 \ "'foo bar'"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6661
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6662 " Float
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6663 if has('float')
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6664 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
6665 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6666 echo a
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6667 echo string(a)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6668 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6669 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
6670 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
6671 \ "-1.2"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6672 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6673
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6674 " Funcref
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6675 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6676 echo function('string')
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6677 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
6678 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6679 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
6680 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
6681 \ "function('string')"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6682
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6683 " Recursive dictionary
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6684 let a = {}
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6685 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
6686 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6687 echo a
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6688 echo string(a)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6689 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6690 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
6691 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
6692 \ "{'a': {...}}"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6693
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6694 " Recursive list
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6695 let a = [0]
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6696 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
6697 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6698 echo a
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6699 echo string(a)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6700 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6701 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
6702 call assert_equal(["[[...]]",
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6703 \ "[[...]]"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6704
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6705 " 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
6706 let a = {}
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6707 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6708 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
6709 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
6710 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6711 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
6712 call assert_equal(["[{}, {}, {}]",
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6713 \ "[{}, {}, {}]"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6714
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6715 " 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
6716 let a = {}
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6717 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
6718 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6719 echo b
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6720 echo string(b)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6721 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6722 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
6723 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
6724 \ "{'a': {}, 'b': {}}"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6725
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6726 " 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
6727 let a = []
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6728 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6729 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
6730 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
6731 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6732 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
6733 call assert_equal(["[[], [], []]",
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6734 \ "[[], [], []]"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6735
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6736 " 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
6737 let a = []
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6738 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
6739 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6740 echo b
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6741 echo string(b)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6742 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6743 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
6744 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
6745 \ "{'a': [], 'b': []}"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6746
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6747 " 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
6748 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
6749 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6750 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
6751 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
6752 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6753 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
6754 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
6755 \ "[{'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
6756
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6757 " 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
6758 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
6759 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
6760 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6761 echo b
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6762 echo string(b)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6763 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6764 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
6765 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
6766 \ "{'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
6767
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6768 " 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
6769 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
6770 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6771 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
6772 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
6773 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6774 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
6775 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
6776 \ "[[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
6777
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6778 " 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
6779 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
6780 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
6781 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6782 echo b
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6783 echo string(b)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6784 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6785 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
6786 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
6787 \ "{'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
6788
19991
f27473034f26 patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
6789 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
6790 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
6791 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
6792
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6793 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6794
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6795 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6796 " 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
6797 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6798
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6799 func Test_num64()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6800 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
6801 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
6802 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
6803 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
6804
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6805 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
6806 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
6807 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
6808
19249
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 19035
diff changeset
6809 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
6810 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
6811 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
6812 endif
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6813
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6814 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
6815 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
6816 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
6817 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
6818 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
6819 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6820
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6821 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6822 " 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
6823 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6824
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6825 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
6826 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
6827 exec func
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6828 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6829
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6830 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
6831 " :append
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6832 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6833 call DefineFunction('T_Append', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6834 \ 'append',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6835 \ 'py <<EOS',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6836 \ '.',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6837 \ ])
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6838 catch
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6839 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
6840 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6841 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6842 call DefineFunction('T_Append', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6843 \ 'append',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6844 \ 'abc',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6845 \ ])
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6846 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
6847 catch
23191
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
6848 call assert_exception('Vim(function):E1145: Missing heredoc end marker: .')
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6849 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6850
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6851 " :change
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6852 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6853 call DefineFunction('T_Change', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6854 \ 'change',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6855 \ 'py <<EOS',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6856 \ '.',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6857 \ ])
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6858 catch
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6859 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
6860 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6861 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6862 call DefineFunction('T_Change', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6863 \ 'change',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6864 \ 'abc',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6865 \ ])
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6866 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
6867 catch
23191
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
6868 call assert_exception('Vim(function):E1145: Missing heredoc end marker: .')
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6869 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6870
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6871 " :insert
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6872 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6873 call DefineFunction('T_Insert', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6874 \ 'insert',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6875 \ 'py <<EOS',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6876 \ '.',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6877 \ ])
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6878 catch
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6879 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
6880 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6881 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6882 call DefineFunction('T_Insert', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6883 \ 'insert',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6884 \ 'abc',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6885 \ ])
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6886 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
6887 catch
23191
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
6888 call assert_exception('Vim(function):E1145: Missing heredoc end marker: .')
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6889 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6890 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6891
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6892 "-------------------------------------------------------------------------------
11352
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
6893 " 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
6894 "
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
6895 " 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
6896 " 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
6897 "-------------------------------------------------------------------------------
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
6898 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
6899
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
6900 \
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
6901 endfunc
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
6902
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
6903 "-------------------------------------------------------------------------------
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6904 " Test 97: bitwise functions {{{1
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6905 "-------------------------------------------------------------------------------
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6906 func Test_bitwise_functions()
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6907 " and
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6908 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
6909 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
6910 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
6911 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
6912 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
6913 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
6914 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
6915 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
6916 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
6917 endif
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6918 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
6919 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
6920 " or
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6921 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
6922 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
6923 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
6924 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
6925 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
6926 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
6927 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
6928 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
6929 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
6930 endif
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6931 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
6932 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
6933 " xor
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6934 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
6935 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
6936 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
6937 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
6938 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
6939 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
6940 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
6941 endif
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6942 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
6943 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
6944 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
6945 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
6946 " invert
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6947 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
6948 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
6949 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
6950 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
6951 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
6952 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
6953 endif
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6954 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
6955 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
6956 endfunc
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
6957
11547
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
6958 " 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
6959 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
6960 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
6961 Ni!
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
6962 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
6963 unlet nieuw
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
6964 delcommand Nieuw
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
6965 endfunc
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
6966
19035
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6967 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
6968 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
6969 func s:snr()
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6970 return expand('<sfile>')
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6971 endfunc
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6972 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
6973 END
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6974 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
6975 source Xexpand
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6976 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
6977 source Xexpand
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6978 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
6979
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6980 call delete('Xexpand')
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6981 unlet g:result
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6982 endfunc
b920ae62c7b1 patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents: 18556
diff changeset
6983
15790
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6984 func Test_compound_assignment_operators()
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6985 " Test for number
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6986 let x = 1
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6987 let x += 10
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6988 call assert_equal(11, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6989 let x -= 5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6990 call assert_equal(6, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6991 let x *= 4
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6992 call assert_equal(24, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6993 let x /= 3
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6994 call assert_equal(8, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6995 let x %= 3
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6996 call assert_equal(2, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6997 let x .= 'n'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6998 call assert_equal('2n', x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
6999
15969
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7000 " 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
7001 let x = 1
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7002 let x /= 0
19427
fdfe44ac6a1a patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
7003 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
7004
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7005 let x = -1
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7006 let x /= 0
19427
fdfe44ac6a1a patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
7007 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
7008
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7009 let x = 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7010 let x /= 0
19427
fdfe44ac6a1a patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
7011 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
7012
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7013 let x = 1
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7014 let x %= 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7015 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
7016
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7017 let x = -1
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7018 let x %= 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7019 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
7020
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7021 let x = 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7022 let x %= 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
7023 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
7024
15790
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7025 " Test for string
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7026 let x = 'str'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7027 let x .= 'ing'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7028 call assert_equal('string', x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7029 let x += 1
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7030 call assert_equal(1, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7031
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7032 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
7033 " 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
7034 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
7035 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
7036 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
7037 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
7038 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
7039 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
7040 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
7041 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
7042 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
7043 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
7044 call assert_equal(4.2, x)
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7045 call assert_fails('let x %= 0.5', 'E734:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7046 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
7047 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
7048 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
7049
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 20109
diff changeset
7050 " 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
7051 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
7052 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
7053 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
7054 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
7055 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
7056 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
7057 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
7058 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
7059 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
7060 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
7061 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
7062 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
7063 endif
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7064
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7065 " Test for environment variable
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7066 let $FOO = 1
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7067 call assert_fails('let $FOO += 1', 'E734:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7068 call assert_fails('let $FOO -= 1', 'E734:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7069 call assert_fails('let $FOO *= 1', 'E734:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7070 call assert_fails('let $FOO /= 1', 'E734:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7071 call assert_fails('let $FOO %= 1', 'E734:')
15790
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7072 let $FOO .= 's'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7073 call assert_equal('1s', $FOO)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7074 unlet $FOO
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7075
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7076 " 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
7077 let &scrolljump = 1
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7078 let &scrolljump += 5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7079 call assert_equal(6, &scrolljump)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7080 let &scrolljump -= 2
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7081 call assert_equal(4, &scrolljump)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7082 let &scrolljump *= 3
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7083 call assert_equal(12, &scrolljump)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7084 let &scrolljump /= 2
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7085 call assert_equal(6, &scrolljump)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7086 let &scrolljump %= 5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7087 call assert_equal(1, &scrolljump)
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7088 call assert_fails('let &scrolljump .= "j"', 'E734:')
15790
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7089 set scrolljump&vim
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7090
24862
f1a390885192 patch 8.2.2969: subtracting from number option fails when result is zero
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
7091 let &foldlevelstart = 2
f1a390885192 patch 8.2.2969: subtracting from number option fails when result is zero
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
7092 let &foldlevelstart -= 1
f1a390885192 patch 8.2.2969: subtracting from number option fails when result is zero
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
7093 call assert_equal(1, &foldlevelstart)
f1a390885192 patch 8.2.2969: subtracting from number option fails when result is zero
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
7094 let &foldlevelstart -= 1
f1a390885192 patch 8.2.2969: subtracting from number option fails when result is zero
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
7095 call assert_equal(0, &foldlevelstart)
f1a390885192 patch 8.2.2969: subtracting from number option fails when result is zero
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
7096 let &foldlevelstart = 2
f1a390885192 patch 8.2.2969: subtracting from number option fails when result is zero
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
7097 let &foldlevelstart -= 2
f1a390885192 patch 8.2.2969: subtracting from number option fails when result is zero
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
7098 call assert_equal(0, &foldlevelstart)
f1a390885192 patch 8.2.2969: subtracting from number option fails when result is zero
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
7099
15790
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7100 " Test for register
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7101 let @/ = 1
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7102 call assert_fails('let @/ += 1', 'E734:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7103 call assert_fails('let @/ -= 1', 'E734:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7104 call assert_fails('let @/ *= 1', 'E734:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7105 call assert_fails('let @/ /= 1', 'E734:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7106 call assert_fails('let @/ %= 1', 'E734:')
15790
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7107 let @/ .= 's'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7108 call assert_equal('1s', @/)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7109 let @/ = ''
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7110 endfunc
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7111
20093
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7112 func Test_unlet_env()
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7113 let $TESTVAR = 'yes'
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7114 call assert_equal('yes', $TESTVAR)
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7115 call assert_fails('lockvar $TESTVAR', 'E940:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7116 call assert_fails('unlockvar $TESTVAR', 'E940:')
20093
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7117 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
7118 if 0
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7119 unlet $TESTVAR
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7120 endif
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7121 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
7122 unlet $TESTVAR
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7123 call assert_equal('', $TESTVAR)
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7124 endfunc
646c53fa5781 patch 8.2.0602: :unlet $VAR does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 19991
diff changeset
7125
16078
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7126 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
7127 " 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
7128 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
7129 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
7130 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
7131 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
7132 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
7133 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
7134 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
7135 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
7136 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
7137 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7138 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
7139 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
7140 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7141
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7142 " 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
7143 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
7144 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
7145 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
7146 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
7147 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
7148 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
7149 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
7150 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
7151 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
7152 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7153
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7154 " 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
7155 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
7156 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
7157
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7158 let x = {}
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17849
diff changeset
7159 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
7160
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7161 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
7162 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
7163
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7164 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
7165 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
7166 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
7167 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
7168
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7169 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
7170 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
7171 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
7172 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
7173 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
7174 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7175
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7176 " 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
7177 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
7178 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
7179 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
7180 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
7181 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
7182 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
7183 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
7184 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
7185 endfunc
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7186 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
7187 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
7188 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
7189 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
7190 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
7191 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
7192 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
7193 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
7194 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7195 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
7196
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7197 " 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
7198 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
7199 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
7200 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
7201 endfunc
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7202 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
7203 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
7204 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
7205 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
7206 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
7207 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
7208 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
7209 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
7210 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
7211 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
7212 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
7213 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
7214 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
7215 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
7216 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
7217 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
7218 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
7219 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
7220 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
7221 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
7222
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7223 " 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
7224 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
7225 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
7226 endfunc
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7227 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
7228 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
7229 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
7230 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
7231 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
7232 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
7233 endfunc
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
7234
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7235 " 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
7236 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
7237 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
7238 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
7239 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
7240 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
7241 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
7242 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
7243 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
7244 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
7245 call delete('Xscript')
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7246
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7247 " Using endfor with :while
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7248 let caught_e732 = 0
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7249 try
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7250 while v:true
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7251 endfor
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7252 catch /E732:/
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7253 let caught_e732 = 1
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7254 endtry
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7255 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
7256
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7257 " Using endwhile with :for
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7258 let caught_e733 = 0
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7259 try
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7260 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
7261 endwhile
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7262 catch /E733:/
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7263 let caught_e733 = 1
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7264 endtry
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7265 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
7266
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7267 " Using endfunc with :if
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7268 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
7269
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19427
diff changeset
7270 " 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
7271 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
7272
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 20109
diff changeset
7273 " 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
7274 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
7275 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7276
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7277 " 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
7278 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
7279 CheckRunVimInTerminal
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7280
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7281 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
7282 " 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
7283 func Test1()
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7284 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
7285 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
7286 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
7287 @a
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7288 let @a = ''
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7289 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7290
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7291 " 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
7292 func Test2()
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7293 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
7294 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
7295 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
7296 @a
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7297 let @a = ''
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7298 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7299
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7300 " 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
7301 func Test3()
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7302 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
7303 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
7304 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
7305 @a
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7306 let @a = ''
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7307 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7308
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7309 " 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
7310 func Test4()
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7311 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
7312 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
7313 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
7314 @a
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7315 let @a = ''
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7316 endfunc
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7317
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7318 " 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
7319 func Test5()
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7320 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
7321 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
7322 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
7323 @a
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7324 let @a = ''
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7325 endfunc
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7326 [SCRIPT]
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7327 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
7328
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7329 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
7330
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7331 " 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
7332 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
7333 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
7334 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
7335
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7336 " 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
7337 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
7338 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
7339 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
7340
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7341 " 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
7342 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
7343 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
7344 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
7345
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7346 " 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
7347 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
7348 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
7349 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
7350
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7351 " 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
7352 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
7353 call TermWait(buf)
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7354 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
7355 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
7356 call TermWait(buf)
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
7357
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7358 "let l = ''
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7359 "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
7360 " 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
7361 "endfor
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7362 "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
7363
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7364 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
7365 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
7366 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
7367
19724
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19689
diff changeset
7368 " 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
7369 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
7370 if has('float')
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7371 call assert_fails('let x = 4.0 % 2.0', 'E804:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21925
diff changeset
7372 call assert_fails('echo 1.1[0]', 'E806:')
19724
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19689
diff changeset
7373 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
7374 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
7375 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
7376 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
7377 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
7378 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
7379 endif
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19689
diff changeset
7380 endfunc
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19689
diff changeset
7381
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
7382 " 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
7383 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
7384 " 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
7385 let caught_e128 = 0
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7386 try
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7387 func! g:test()
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7388 echo "test"
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7389 endfunc
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7390 catch /E128:/
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7391 let caught_e128 = 1
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7392 endtry
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7393 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
7394
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7395 " 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
7396 let caught_e884 = 0
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7397 try
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7398 func! b:test()
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7399 echo "test"
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7400 endfunc
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7401 catch /E884:/
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7402 let caught_e884 = 1
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7403 endtry
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7404 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
7405
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
7406 " function name followed by #
20109
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7407 let caught_e128 = 0
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7408 try
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7409 func! test2() "#
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7410 echo "test2"
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7411 endfunc
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7412 catch /E128:/
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7413 let caught_e128 = 1
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7414 endtry
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7415 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
7416
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7417 " 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
7418 function! g:Foo(n)
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7419 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
7420 endfunction
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7421 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
7422 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
7423 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
7424 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
7425 delfunc g:Foo
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7426
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7427 " 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
7428 let lines =<< trim END
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7429 func s:Testje()
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7430 return "foo"
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7431 endfunc
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7432 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
7433 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
7434 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
7435 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
7436 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
7437 END
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7438 call writefile(lines, 'Xscript')
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7439 source Xscript
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7440 call delete('Xscript')
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7441 endfunc
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7442
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
7443 " 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
7444 func Test_substring_var()
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7445 let str = 'abcdef'
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7446 let n = 3
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7447 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
7448 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
7449 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
7450 unlet n
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7451 let nn = 3
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7452 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
7453 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
7454 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
7455 unlet nn
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7456 let b:nn = 4
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7457 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
7458 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
7459 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
7460 unlet b:nn
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7461 endfunc
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20093
diff changeset
7462
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
7463 " 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
7464 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
7465 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
7466
8fb0e507491d patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
7467 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
7468
8fb0e507491d patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
7469 " 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
7470 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
7471 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
7472 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
7473
8fb0e507491d patch 8.2.1106: crash when trying to use s: variable in typed command
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
7474 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
7475 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
7476
21925
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7477 " Test for issue6776 {{{1
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7478 func Test_trinary_expression()
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7479 try
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7480 call eval('0 ? 0')
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7481 catch
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7482 endtry
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7483 " previous failure should not cause next expression to fail
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7484 call assert_equal(v:false, eval(string(v:false)))
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7485
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7486 try
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7487 call eval('0 ? "burp')
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7488 catch
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7489 endtry
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7490 " previous failure should not cause next expression to fail
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7491 call assert_equal(v:false, eval(string(v:false)))
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7492
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7493 try
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7494 call eval('1 ? 0 : "burp')
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7495 catch
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7496 endtry
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7497 " previous failure should not cause next expression to fail
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7498 call assert_equal(v:false, eval(string(v:false)))
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7499 endfunction
51d591dbb8df patch 8.2.1512: failure after trinary expression fails
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
7500
24234
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7501 func Test_for_over_string()
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7502 let res = ''
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7503 for c in 'aéc̀d'
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7504 let res ..= c .. '-'
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7505 endfor
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7506 call assert_equal('a-é-c̀-d-', res)
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7507
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7508 let res = ''
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7509 for c in ''
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7510 let res ..= c .. '-'
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7511 endfor
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7512 call assert_equal('', res)
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7513
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7514 let res = ''
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7515 for c in test_null_string()
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7516 let res ..= c .. '-'
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7517 endfor
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7518 call assert_equal('', res)
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7519 endfunc
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24160
diff changeset
7520
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
7521 "-------------------------------------------------------------------------------
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7522 " Modelines {{{1
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
7523 " 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
7524 "-------------------------------------------------------------------------------