Mercurial > vim
annotate src/testdir/test_vim9_import.vim @ 30819:d50d32026617 v9.0.0744
patch 9.0.0744: in script in autoload dir exported variable is not found
Commit: https://github.com/vim/vim/commit/6c4d4a64449ea225b1a568f5517e309b2054b490
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 13 17:47:42 2022 +0100
patch 9.0.0744: in script in autoload dir exported variable is not found
Problem: In script in autoload dir exported variable is not found. (Doug
Kearns)
Solution: Find the variable with the "script#" prefix. (closes #11361)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Oct 2022 19:00:06 +0200 |
parents | 12e6c7bae2a9 |
children | b4b51e01dd36 |
rev | line source |
---|---|
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Test import/export of the Vim9 script language. |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2 " Also the autoload mechanism. |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 source check.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 source term_util.vim |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
6 import './vim9.vim' as v9 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 let s:export_script_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 var name: string = 'bob' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 def Concat(arg: string): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 return name .. arg |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 g:result = Concat('bie') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 g:localname = name |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 export const CONST = 1234 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 export var exported = 9876 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 export var exp_name = 'John' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 export def Exported(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 return 'Exported' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 export def ExportedValue(): number |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 return exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 export def ExportedInc() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 exported += 5 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 export final theList = [1] |
27146
648a5f658990
patch 8.2.4102: Vim9: import cannot be used after method
Bram Moolenaar <Bram@vim.org>
parents:
27140
diff
changeset
|
30 export def AddSome(s: string): string |
648a5f658990
patch 8.2.4102: Vim9: import cannot be used after method
Bram Moolenaar <Bram@vim.org>
parents:
27140
diff
changeset
|
31 return s .. 'some' |
648a5f658990
patch 8.2.4102: Vim9: import cannot be used after method
Bram Moolenaar <Bram@vim.org>
parents:
27140
diff
changeset
|
32 enddef |
648a5f658990
patch 8.2.4102: Vim9: import cannot be used after method
Bram Moolenaar <Bram@vim.org>
parents:
27140
diff
changeset
|
33 export var AddRef = AddSome |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
36 def s:Undo_export_script_lines() |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 unlet g:result |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 unlet g:localname |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 def Test_vim9_import_export() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 writefile(s:export_script_lines, 'Xexport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 var import_script_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 var dir = './' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 var ext = ".vim" |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 import dir .. 'Xexport' .. ext as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 g:exported1 = expo.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 expo.exported += 3 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 g:exported2 = expo.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 g:exported3 = expo.ExportedValue() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 expo.ExportedInc() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 g:exported_i1 = expo.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 g:exported_i2 = expo.ExportedValue() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 expo.exported = 11 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 g:exported_s1 = expo.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 g:exported_s2 = expo.ExportedValue() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 g:imported_func = expo.Exported() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 def GetExported(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 var local_dict = {ref: expo.Exported} |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 return local_dict.ref() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 g:funcref_result = GetExported() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 |
27265
8a097fc07aa4
patch 8.2.4161: Vim9: warning for missing white space after imported variable
Bram Moolenaar <Bram@vim.org>
parents:
27233
diff
changeset
|
70 def GetName(): string |
8a097fc07aa4
patch 8.2.4161: Vim9: warning for missing white space after imported variable
Bram Moolenaar <Bram@vim.org>
parents:
27233
diff
changeset
|
71 return expo.exp_name .. 'son' |
8a097fc07aa4
patch 8.2.4161: Vim9: warning for missing white space after imported variable
Bram Moolenaar <Bram@vim.org>
parents:
27233
diff
changeset
|
72 enddef |
8a097fc07aa4
patch 8.2.4161: Vim9: warning for missing white space after imported variable
Bram Moolenaar <Bram@vim.org>
parents:
27233
diff
changeset
|
73 g:long_name = GetName() |
8a097fc07aa4
patch 8.2.4161: Vim9: warning for missing white space after imported variable
Bram Moolenaar <Bram@vim.org>
parents:
27233
diff
changeset
|
74 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 g:imported_name = expo.exp_name |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 expo.exp_name ..= ' Doe' |
27177
eb0a1108f885
patch 8.2.4117: Vim9: wrong white space error after using imported item
Bram Moolenaar <Bram@vim.org>
parents:
27150
diff
changeset
|
77 expo.exp_name = expo.exp_name .. ' Maar' |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 g:imported_name_appended = expo.exp_name |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 g:exported_later = expo.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 expo.theList->add(2) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 assert_equal([1, 2], expo.theList) |
27146
648a5f658990
patch 8.2.4102: Vim9: import cannot be used after method
Bram Moolenaar <Bram@vim.org>
parents:
27140
diff
changeset
|
83 |
648a5f658990
patch 8.2.4102: Vim9: import cannot be used after method
Bram Moolenaar <Bram@vim.org>
parents:
27140
diff
changeset
|
84 assert_equal('andthensome', 'andthen'->expo.AddSome()) |
648a5f658990
patch 8.2.4102: Vim9: import cannot be used after method
Bram Moolenaar <Bram@vim.org>
parents:
27140
diff
changeset
|
85 assert_equal('awesome', 'awe'->expo.AddRef()) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 writefile(import_script_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 source Ximport.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 assert_equal('bobbie', g:result) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 assert_equal('bob', g:localname) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 assert_equal(9876, g:exported1) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 assert_equal(9879, g:exported2) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 assert_equal(9879, g:exported3) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 assert_equal(9884, g:exported_i1) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 assert_equal(9884, g:exported_i2) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 assert_equal(11, g:exported_s1) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 assert_equal(11, g:exported_s2) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 assert_equal(11, g:exported_later) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 assert_equal('Exported', g:imported_func) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 assert_equal('Exported', g:funcref_result) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 assert_equal('John', g:imported_name) |
27265
8a097fc07aa4
patch 8.2.4161: Vim9: warning for missing white space after imported variable
Bram Moolenaar <Bram@vim.org>
parents:
27233
diff
changeset
|
106 assert_equal('Johnson', g:long_name) |
27177
eb0a1108f885
patch 8.2.4117: Vim9: wrong white space error after using imported item
Bram Moolenaar <Bram@vim.org>
parents:
27150
diff
changeset
|
107 assert_equal('John Doe Maar', g:imported_name_appended) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 assert_false(exists('g:name')) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 Undo_export_script_lines() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 unlet g:exported1 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 unlet g:exported2 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 unlet g:exported3 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 unlet g:exported_i1 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 unlet g:exported_i2 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 unlet g:exported_later |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 unlet g:imported_func |
27265
8a097fc07aa4
patch 8.2.4161: Vim9: warning for missing white space after imported variable
Bram Moolenaar <Bram@vim.org>
parents:
27233
diff
changeset
|
118 unlet g:imported_name g:long_name g:imported_name_appended |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 delete('Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 # similar, with line breaks |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 var import_line_break_script_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 import './Xexport.vim' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 g:exported = expo.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 expo.exported += 7 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 g:exported_added = expo.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 g:imported_func = expo.Exported() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 writefile(import_line_break_script_lines, 'Ximport_lbr.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 source Ximport_lbr.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 assert_equal(11, g:exported) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 assert_equal(18, g:exported_added) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 assert_equal('Exported', g:imported_func) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 # exported script not sourced again |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 assert_false(exists('g:result')) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 unlet g:exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 unlet g:exported_added |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 unlet g:imported_func |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 delete('Ximport_lbr.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 |
27499
df414fc12eed
patch 8.2.4277: Vim9: an import does not shadow a command modifier
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
145 var import_shadows_cmdmod_lines =<< trim END |
df414fc12eed
patch 8.2.4277: Vim9: an import does not shadow a command modifier
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
146 vim9script |
df414fc12eed
patch 8.2.4277: Vim9: an import does not shadow a command modifier
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
147 import './Xexport.vim' as vim9 |
df414fc12eed
patch 8.2.4277: Vim9: an import does not shadow a command modifier
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
148 vim9.exp_name = 'Shadow' |
df414fc12eed
patch 8.2.4277: Vim9: an import does not shadow a command modifier
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
149 assert_equal('Shadow', vim9.exp_name) |
df414fc12eed
patch 8.2.4277: Vim9: an import does not shadow a command modifier
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
150 END |
df414fc12eed
patch 8.2.4277: Vim9: an import does not shadow a command modifier
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
151 v9.CheckScriptSuccess(import_shadows_cmdmod_lines) |
df414fc12eed
patch 8.2.4277: Vim9: an import does not shadow a command modifier
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
152 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 var line_break_before_dot =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 import './Xexport.vim' as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 g:exported = expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 .exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 writefile(line_break_before_dot, 'Ximport_lbr_before_dot.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 assert_fails('source Ximport_lbr_before_dot.vim', 'E1060:', '', 3) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 delete('Ximport_lbr_before_dot.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 var line_break_after_dot =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 import './Xexport.vim' as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 g:exported = expo. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 writefile(line_break_after_dot, 'Ximport_lbr_after_dot.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 assert_fails('source Ximport_lbr_after_dot.vim', 'E1074:', '', 3) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 delete('Ximport_lbr_after_dot.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 var import_star_as_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 import './Xexport.vim' as Export |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 def UseExport() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 g:exported_def = Export.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 g:exported_script = Export.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 assert_equal(1, exists('Export.exported')) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 assert_equal(0, exists('Export.notexported')) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 UseExport() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 writefile(import_star_as_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 source Ximport.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 assert_equal(18, g:exported_def) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 assert_equal(18, g:exported_script) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 unlet g:exported_def |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 unlet g:exported_script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 var import_star_as_lines_no_dot =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 import './Xexport.vim' as Export |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 def Func() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 var dummy = 1 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 var imported = Export + dummy |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 defcompile |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 writefile(import_star_as_lines_no_dot, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 assert_fails('source Ximport.vim', 'E1060:', '', 2, 'Func') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 var import_star_as_lines_dot_space =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 import './Xexport.vim' as Export |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 def Func() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 var imported = Export . exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 defcompile |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 writefile(import_star_as_lines_dot_space, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 assert_fails('source Ximport.vim', 'E1074:', '', 1, 'Func') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
215 writefile(s:export_script_lines, 'Xexport2.vim') |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
216 var import_as_duplicated =<< trim END |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 import './Xexport.vim' as expo |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
219 import './Xexport2.vim' as expo |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 END |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
221 writefile(import_as_duplicated, 'Ximport.vim') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 assert_fails('source Ximport.vim', 'E1073:', '', 3, 'Ximport.vim') |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
223 delete('Xexport2.vim') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 var import_star_as_lines_script_no_dot =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 import './Xexport.vim' as Export |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 g:imported_script = Export exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 writefile(import_star_as_lines_script_no_dot, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 assert_fails('source Ximport.vim', 'E1060: Expected dot after name: Export exported') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 var import_star_as_lines_script_space_after_dot =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 import './Xexport.vim' as Export |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 g:imported_script = Export. exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 writefile(import_star_as_lines_script_space_after_dot, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 assert_fails('source Ximport.vim', 'E1074:') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 var import_star_as_lines_missing_name =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 import './Xexport.vim' as Export |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 def Func() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 var imported = Export. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 defcompile |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 writefile(import_star_as_lines_missing_name, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
250 assert_fails('source Ximport.vim', 'E1048:', '', 1, 'Func') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 var import_star_as_lbr_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 import './Xexport.vim' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 as Export |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 def UseExport() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 g:exported = Export.exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 UseExport() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 writefile(import_star_as_lbr_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 source Ximport.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 assert_equal(18, g:exported) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 unlet g:exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 # try to use something that exists but is not exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
267 var import_not_exported_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 import './Xexport.vim' as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 echo expo.name |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 writefile(import_not_exported_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 assert_fails('source Ximport.vim', 'E1049:', '', 3, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 # try to import something that is already defined |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 var import_already_defined =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 var exported = 'something' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 import './Xexport.vim' as exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 writefile(import_already_defined, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 assert_fails('source Ximport.vim', 'E1054:', '', 3, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 # try changing an imported const |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 var import_assign_to_const =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 import './Xexport.vim' as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 def Assign() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 expo.CONST = 987 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 defcompile |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 writefile(import_assign_to_const, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 assert_fails('source Ximport.vim', 'E46:', '', 1, '_Assign') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 # try changing an imported final |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 var import_assign_to_final =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
298 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
299 import './Xexport.vim' as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
300 def Assign() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
301 expo.theList = [2] |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
302 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
303 defcompile |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
304 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
305 writefile(import_assign_to_final, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
306 assert_fails('source Ximport.vim', 'E46:', '', 1, '_Assign') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
308 var import_no_as_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
309 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
310 import './Xexport.vim' name |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
311 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
312 writefile(import_no_as_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
313 assert_fails('source Ximport.vim', 'E488:', '', 2, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 |
29006
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
315 # trailing starts with "as" |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
316 var import_bad_as_lines =<< trim END |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
317 vim9script |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
318 import './Xexport.vim' asname |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
319 END |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
320 writefile(import_no_as_lines, 'Ximport.vim') |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
321 assert_fails('source Ximport.vim', 'E488:', '', 2, 'Ximport.vim') |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
322 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 var import_invalid_string_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 import Xexport.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 writefile(import_invalid_string_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
328 assert_fails('source Ximport.vim', 'E121:', '', 2, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 var import_wrong_name_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 import './XnoExport.vim' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
333 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 writefile(import_wrong_name_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 assert_fails('source Ximport.vim', 'E1053:', '', 2, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
336 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 var import_redefining_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 import './Xexport.vim' as exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
340 var exported = 5 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
342 writefile(import_redefining_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 assert_fails('source Ximport.vim', 'E1213: Redefining imported item "exported"', '', 3) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
344 |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
345 var import_missing_dot_lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
346 vim9script |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
347 import './Xexport.vim' as expo |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
348 def Test() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
349 expo = 9 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
350 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
351 defcompile |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
352 END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
353 writefile(import_missing_dot_lines, 'Ximport.vim') |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
354 assert_fails('source Ximport.vim', 'E1258:', '', 1) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
355 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
356 var import_missing_name_lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
357 vim9script |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
358 import './Xexport.vim' as expo |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
359 def Test() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
360 expo.99 = 9 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
361 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
362 defcompile |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
363 END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
364 writefile(import_missing_name_lines, 'Ximport.vim') |
27059
e97cf16731d9
patch 8.2.4058: Vim9: import test failure in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
365 assert_fails('source Ximport.vim', 'E1259:', '', 1) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
366 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
367 var import_assign_wrong_type_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
369 import './Xexport.vim' as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
370 expo.exported = 'xxx' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 writefile(import_assign_wrong_type_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 assert_fails('source Ximport.vim', 'E1012: Type mismatch; expected number but got string', '', 3) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 var import_assign_const_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 import './Xexport.vim' as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
378 expo.CONST = 4321 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 writefile(import_assign_const_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 assert_fails('source Ximport.vim', 'E46: Cannot change read-only variable "CONST"', '', 3) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
383 delete('Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 delete('Xexport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 # Check that in a Vim9 script 'cpo' is set to the Vim default. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 # Flags added or removed are also applied to the restored value. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
388 set cpo=abcd |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
391 g:cpo_in_vim9script = &cpo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 set cpo+=f |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
393 set cpo-=c |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 g:cpo_after_vim9script = &cpo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
396 writefile(lines, 'Xvim9_script') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 source Xvim9_script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 assert_equal('fabd', &cpo) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 set cpo&vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 assert_equal(&cpo, g:cpo_in_vim9script) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 var newcpo = substitute(&cpo, 'c', '', '') .. 'f' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 assert_equal(newcpo, g:cpo_after_vim9script) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 delete('Xvim9_script') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 |
29006
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
407 def Test_import_very_long_name() |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
408 var lines =<< trim END |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
409 vim9script |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
410 |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
411 export var verylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongname = 'asdf' |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
412 END |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
413 writefile(lines, 'Xverylong.vim') |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
414 |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
415 lines =<< trim END |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
416 vim9script |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
417 import './Xverylong.vim' |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
418 |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
419 g:result = Xverylong.verylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongnameverylongname |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
420 END |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
421 v9.CheckScriptSuccess(lines) |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
422 assert_equal('asdf', g:result) |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
423 |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
424 delete('Xverylong.vim') |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
425 unlet g:result |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
426 enddef |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
427 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 def Test_import_funcref() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
429 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
431 export def F(): number |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 return 42 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 export const G = F |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
435 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
436 writefile(lines, 'Xlib.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 import './Xlib.vim' as lib |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 const Foo = lib.G() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 assert_equal(42, Foo) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 def DoTest() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 const Goo = lib.G() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 assert_equal(42, Goo) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
447 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
448 DoTest() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
450 v9.CheckScriptSuccess(lines) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
451 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 delete('Xlib.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 |
30705
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
455 def Test_export_closure() |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
456 # tests that the closure in block can be compiled, not the import part |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
457 var lines =<< trim END |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
458 vim9script |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
459 { |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
460 var foo = 42 |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
461 export def Bar(): number |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
462 return foo |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
463 enddef |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
464 } |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
465 assert_equal(42, Bar()) |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
466 END |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
467 v9.CheckScriptSuccess(lines) |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
468 enddef |
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
469 |
27807
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
470 def Test_import_duplicate_function() |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
471 # Function Hover() exists in both scripts, partial should refer to the right |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
472 # one. |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
473 var lines =<< trim END |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
474 vim9script |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
475 |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
476 def Hover(d: dict<any>): string |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
477 return 'found it' |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
478 enddef |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
479 |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
480 export def NewLspServer(): dict<any> |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
481 var d: dict<any> = {} |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
482 d->extend({hover: function('Hover', [d])}) |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
483 return d |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
484 enddef |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
485 |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
486 NewLspServer() |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
487 END |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
488 writefile(lines, 'Xserver.vim') |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
489 |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
490 lines =<< trim END |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
491 vim9script |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
492 |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
493 import './Xserver.vim' as server |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
494 |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
495 export def Hover() |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
496 enddef |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
497 |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
498 def AddServer() |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
499 var d: dict<any> = server.NewLspServer() |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
500 assert_equal('found it', d.hover()) |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
501 enddef |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
502 AddServer() |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
503 END |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
504 v9.CheckScriptSuccess(lines) |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
505 |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
506 delete('Xserver.vim') |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
507 enddef |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
508 |
292a6bd86c30
patch 8.2.4429: using script-local function from the wrong script
Bram Moolenaar <Bram@vim.org>
parents:
27756
diff
changeset
|
509 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 def Test_import_fails() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 writefile([], 'Xfoo.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 import './Xfoo.vim' as foo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 foo = 'bar' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
516 v9.CheckDefAndScriptFailure(lines, ['E1094:', 'E1236: Cannot use foo itself']) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 import './Xfoo.vim' as foo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 var that = foo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
522 v9.CheckScriptFailure(lines, 'E1060: Expected dot after name: foo') |
27277
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
523 lines =<< trim END |
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
524 vim9script |
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
525 import './Xfoo.vim' as foo |
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
526 var that: any |
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
527 that += foo |
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
528 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
529 v9.CheckScriptFailure(lines, 'E1060: Expected dot after name: foo') |
27277
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
530 lines =<< trim END |
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
531 vim9script |
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
532 import './Xfoo.vim' as foo |
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
533 foo += 9 |
b73e3617c1d6
patch 8.2.4167: Vim9: error message for old style import
Bram Moolenaar <Bram@vim.org>
parents:
27269
diff
changeset
|
534 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
535 v9.CheckScriptFailure(lines, 'E1060: Expected dot after name: foo') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
536 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
537 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 import './Xfoo.vim' as 9foo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
540 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
541 v9.CheckScriptFailure(lines, 'E1047:') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
543 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
544 import './Xfoo.vim' as the#foo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
545 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
546 v9.CheckScriptFailure(lines, 'E1047:') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
547 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
548 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 import './Xfoo.vim' as g:foo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
550 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
551 v9.CheckScriptFailure(lines, 'E1047:') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
554 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
555 def TheFunc() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
556 echo 'the func' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
557 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
558 export var Ref = TheFunc |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
559 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
560 writefile([], 'Xthat.vim') |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
561 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
562 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
563 import './Xthat.vim' as That |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
564 That() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
565 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
566 v9.CheckDefAndScriptFailure(lines, ['E1094:', 'E1236: Cannot use That itself']) |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
567 |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
568 lines =<< trim END |
27233
73232ed49cf2
patch 8.2.4145: confusing error when using name of import for a function
Bram Moolenaar <Bram@vim.org>
parents:
27217
diff
changeset
|
569 vim9script |
73232ed49cf2
patch 8.2.4145: confusing error when using name of import for a function
Bram Moolenaar <Bram@vim.org>
parents:
27217
diff
changeset
|
570 import './Xthat.vim' as That |
73232ed49cf2
patch 8.2.4145: confusing error when using name of import for a function
Bram Moolenaar <Bram@vim.org>
parents:
27217
diff
changeset
|
571 def Func() |
73232ed49cf2
patch 8.2.4145: confusing error when using name of import for a function
Bram Moolenaar <Bram@vim.org>
parents:
27217
diff
changeset
|
572 echo That() |
73232ed49cf2
patch 8.2.4145: confusing error when using name of import for a function
Bram Moolenaar <Bram@vim.org>
parents:
27217
diff
changeset
|
573 enddef |
73232ed49cf2
patch 8.2.4145: confusing error when using name of import for a function
Bram Moolenaar <Bram@vim.org>
parents:
27217
diff
changeset
|
574 Func() |
73232ed49cf2
patch 8.2.4145: confusing error when using name of import for a function
Bram Moolenaar <Bram@vim.org>
parents:
27217
diff
changeset
|
575 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
576 v9.CheckScriptFailure(lines, 'E1236: Cannot use That itself') |
27233
73232ed49cf2
patch 8.2.4145: confusing error when using name of import for a function
Bram Moolenaar <Bram@vim.org>
parents:
27217
diff
changeset
|
577 |
73232ed49cf2
patch 8.2.4145: confusing error when using name of import for a function
Bram Moolenaar <Bram@vim.org>
parents:
27217
diff
changeset
|
578 lines =<< trim END |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
579 import './Xthat.vim' as one |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
580 import './Xthat.vim' as two |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
581 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
582 v9.CheckScriptFailure(lines, 'E1262:') |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
583 |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
584 delete('Xthat.vim') |
27607
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
585 |
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
586 lines =<< trim END |
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
587 vim9script |
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
588 export var item = 'hello' |
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
589 import './Xyourself.vim' |
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
590 END |
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
591 writefile(lines, 'Xyourself.vim') |
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
592 assert_fails('source Xyourself.vim', 'E1088:') |
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
593 delete('Xyourself.vim') |
db1831f585a4
patch 8.2.4330: Vim9: no error if script imports itself
Bram Moolenaar <Bram@vim.org>
parents:
27563
diff
changeset
|
594 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
595 mkdir('Ximport') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
596 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
597 writefile(['vim9script'], 'Ximport/.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
598 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
599 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
600 import './Ximport/.vim' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
601 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
602 v9.CheckScriptFailure(lines, 'E1261: Cannot import .vim without using "as"') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
603 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
604 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
605 import './Ximport/.vim' as vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
606 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
607 v9.CheckScriptSuccess(lines) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
608 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
609 writefile(['vim9script'], 'Ximport/.vimrc') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
610 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
611 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
612 import './Ximport/.vimrc' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
614 v9.CheckScriptFailure(lines, 'E1257: Imported script must use "as" or end in .vim') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
616 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
617 import './Ximport/.vimrc' as vimrc |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
618 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
619 v9.CheckScriptSuccess(lines) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
620 |
28570
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
621 new |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
622 setline(1, ['vim9script', 'import "" as abc']) |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
623 assert_fails('source', 'E1071: Invalid string for :import: "" as abc') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
624 setline(2, 'import [] as abc') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
625 assert_fails('source', 'E1071: Invalid string for :import: [] as abc') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
626 setline(2, 'import test_null_string() as abc') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
627 assert_fails('source', 'E1071: Invalid string for :import: test_null_string() as abc') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
628 bw! |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
629 call writefile(['vim9script', "import './Xfoo.vim' ask expo"], 'Xbar.vim') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
630 assert_fails('source Xbar.vim', 'E488: Trailing characters: ask expo') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
631 writefile([], 'Xtemp') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
632 call writefile(['vim9script', "import './Xtemp'"], 'Xbar.vim') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
633 assert_fails('source Xbar.vim', 'E1257: Imported script must use "as" or end in .vim: Xtemp') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
634 delete('Xtemp') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
635 call writefile(['vim9script', "import './Xfoo.vim' as abc | foobar"], 'Xbar.vim') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
636 assert_fails('source Xbar.vim', 'E492: Not an editor command: foobar') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
637 call delete('Xbar.vim') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
638 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
639 delete('Ximport', 'rf') |
28570
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
640 delete('Xfoo.vim') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
641 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
642 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
643 func g:Trigger() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
644 source Ximport.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
645 return "echo 'yes'\<CR>" |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 endfunc |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
647 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
648 def Test_import_export_expr_map() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
649 # check that :import and :export work when buffer is locked |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
650 var export_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
651 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
652 export def That(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
653 return 'yes' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
655 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 writefile(export_lines, 'Xexport_that.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
657 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
658 var import_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
659 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
660 import './Xexport_that.vim' as that |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
661 assert_equal('yes', that.That()) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
662 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
663 writefile(import_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
664 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 nnoremap <expr> trigger g:Trigger() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
666 feedkeys('trigger', "xt") |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
667 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
668 delete('Xexport_that.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
669 delete('Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
670 nunmap trigger |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
672 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 def Test_import_in_filetype() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 # check that :import works when the buffer is locked |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
675 mkdir('ftplugin', 'p') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
676 var export_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
677 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
678 export var That = 'yes' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
679 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
680 writefile(export_lines, 'ftplugin/Xexport_ft.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
681 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
682 var import_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
683 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
684 import './Xexport_ft.vim' as ft |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
685 assert_equal('yes', ft.That) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
686 g:did_load_mytpe = 1 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
687 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
688 writefile(import_lines, 'ftplugin/qf.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
689 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
690 var save_rtp = &rtp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
691 &rtp = getcwd() .. ',' .. &rtp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
692 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
693 filetype plugin on |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
694 copen |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
695 assert_equal(1, g:did_load_mytpe) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
696 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
697 quit! |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
698 delete('Xexport_ft.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
699 delete('ftplugin', 'rf') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
700 &rtp = save_rtp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
701 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
702 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
703 def Test_use_import_in_mapping() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
704 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
705 vim9script |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
706 export def Funcx(nr: number) |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
707 g:result = nr |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
708 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
709 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
710 writefile(lines, 'XsomeExport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
711 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
712 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
713 import './XsomeExport.vim' as some |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
714 var Funcy = some.Funcx |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
715 nnoremap <F3> :call <sid>Funcy(42)<cr> |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
716 nnoremap <F4> :call <sid>some.Funcx(44)<cr> |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
717 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
718 writefile(lines, 'Xmapscript.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
719 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
720 source Xmapscript.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
721 feedkeys("\<F3>", "xt") |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
722 assert_equal(42, g:result) |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
723 feedkeys("\<F4>", "xt") |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
724 assert_equal(44, g:result) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
725 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
726 unlet g:result |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
727 delete('XsomeExport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
728 delete('Xmapscript.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
729 nunmap <F3> |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
730 nunmap <F4> |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
731 enddef |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
732 |
28453
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
733 def Test_use_relative_autoload_import_in_mapping() |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
734 var lines =<< trim END |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
735 vim9script |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
736 export def Func() |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
737 g:result = 42 |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
738 enddef |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
739 END |
28453
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
740 writefile(lines, 'XrelautoloadExport.vim') |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
741 lines =<< trim END |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
742 vim9script |
28453
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
743 import autoload './XrelautoloadExport.vim' as some |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
744 nnoremap <F3> :call <SID>some.Func()<CR> |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
745 END |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
746 writefile(lines, 'Xmapscript.vim') |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
747 |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
748 source Xmapscript.vim |
28453
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
749 assert_match('\d\+ A: .*XrelautoloadExport.vim', execute('scriptnames')->split("\n")[-1]) |
29861
8dca33bca038
patch 9.0.0269: getscriptinfo() does not include the version
Bram Moolenaar <Bram@vim.org>
parents:
29836
diff
changeset
|
750 var l = getscriptinfo() |
8dca33bca038
patch 9.0.0269: getscriptinfo() does not include the version
Bram Moolenaar <Bram@vim.org>
parents:
29836
diff
changeset
|
751 assert_match('XrelautoloadExport.vim$', l[-1].name) |
8dca33bca038
patch 9.0.0269: getscriptinfo() does not include the version
Bram Moolenaar <Bram@vim.org>
parents:
29836
diff
changeset
|
752 assert_true(l[-1].autoload) |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
753 feedkeys("\<F3>", "xt") |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
754 assert_equal(42, g:result) |
29861
8dca33bca038
patch 9.0.0269: getscriptinfo() does not include the version
Bram Moolenaar <Bram@vim.org>
parents:
29836
diff
changeset
|
755 l = getscriptinfo({name: 'XrelautoloadExport'}) |
8dca33bca038
patch 9.0.0269: getscriptinfo() does not include the version
Bram Moolenaar <Bram@vim.org>
parents:
29836
diff
changeset
|
756 assert_true(len(l) == 1) |
8dca33bca038
patch 9.0.0269: getscriptinfo() does not include the version
Bram Moolenaar <Bram@vim.org>
parents:
29836
diff
changeset
|
757 assert_match('XrelautoloadExport.vim$', l[0].name) |
8dca33bca038
patch 9.0.0269: getscriptinfo() does not include the version
Bram Moolenaar <Bram@vim.org>
parents:
29836
diff
changeset
|
758 assert_false(l[0].autoload) |
29930
cd573d7bc30d
patch 9.0.0303: it is not easy to get information about a script
Bram Moolenaar <Bram@vim.org>
parents:
29861
diff
changeset
|
759 assert_equal(999999, l[0].version) |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
760 |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
761 unlet g:result |
28453
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
762 delete('XrelautoloadExport.vim') |
28447
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
763 delete('Xmapscript.vim') |
6f753a8125f0
patch 8.2.4748: cannot use an imported function in a mapping
Bram Moolenaar <Bram@vim.org>
parents:
28309
diff
changeset
|
764 nunmap <F3> |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
765 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
766 |
29006
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
767 def Test_autoload_import_var() |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
768 # variable name starts with "autoload" |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
769 var lines =<< trim END |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
770 vim9script |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
771 var autoloaded = "Xtest.vim" |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
772 import autoloaded |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
773 END |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
774 v9.CheckScriptFailure(lines, 'E1053: Could not import "Xtest.vim') |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
775 enddef |
99a7eb1881c7
patch 8.2.5025: Vim9: a few lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28594
diff
changeset
|
776 |
28453
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
777 def Test_use_autoload_import_in_mapping() |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
778 var lines =<< trim END |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
779 vim9script |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
780 export def Func() |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
781 g:result = 49 |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
782 enddef |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
783 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
784 mkdir('Ximpdir/autoload', 'p') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
785 writefile(lines, 'Ximpdir/autoload/XautoloadExport.vim') |
28453
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
786 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
787 exe 'set rtp^=' .. getcwd() .. '/Ximpdir' |
28453
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
788 |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
789 lines =<< trim END |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
790 vim9script |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
791 import autoload 'XautoloadExport.vim' as some |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
792 nnoremap <F3> :call <SID>some.Func()<CR> |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
793 END |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
794 writefile(lines, 'Xmapscript.vim') |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
795 |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
796 source Xmapscript.vim |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
797 assert_match('\d\+ A: .*autoload/XautoloadExport.vim', execute('scriptnames')->split("\n")[-1]) |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
798 feedkeys("\<F3>", "xt") |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
799 assert_equal(49, g:result) |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
800 |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
801 unlet g:result |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
802 delete('Xmapscript.vim') |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
803 nunmap <F3> |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
804 delete('Ximpdir', 'rf') |
28453
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
805 &rtp = save_rtp |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
806 enddef |
862068e9e2a7
patch 8.2.4751: mapping <SID>name.Func does not work for autoload script
Bram Moolenaar <Bram@vim.org>
parents:
28447
diff
changeset
|
807 |
27285
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
808 def Test_use_import_in_command_completion() |
27189
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
809 var lines =<< trim END |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
810 vim9script |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
811 export def Complete(..._): list<string> |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
812 return ['abcd'] |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
813 enddef |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
814 END |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
815 writefile(lines, 'Xscript.vim') |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
816 |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
817 lines =<< trim END |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
818 vim9script |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
819 import './Xscript.vim' |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
820 |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
821 command -nargs=1 -complete=customlist,Xscript.Complete Cmd echo 'ok' |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
822 feedkeys(":Cmd ab\<Tab>\<C-B>#\<CR>", 'xnt') |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
823 assert_equal('#Cmd abcd', @:) |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
824 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
825 v9.CheckScriptSuccess(lines) |
27189
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
826 |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
827 delcommand Cmd |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
828 delete('Xscript.vim') |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
829 enddef |
a10936038ec9
patch 8.2.4123: complete function cannot be import.Name
Bram Moolenaar <Bram@vim.org>
parents:
27177
diff
changeset
|
830 |
28461
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
831 def Test_use_import_with_funcref_in_command_completion() |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
832 var lines =<< trim END |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
833 vim9script |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
834 export def Complete(..._): list<string> |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
835 return ['abcd'] |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
836 enddef |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
837 END |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
838 writefile(lines, 'Xscript.vim') |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
839 |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
840 lines =<< trim END |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
841 vim9script |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
842 import './Xscript.vim' |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
843 |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
844 var Ref = Xscript.Complete |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
845 exe "command -nargs=1 -complete=customlist," .. expand('<SID>') .. "Ref Cmd echo 'ok'" |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
846 feedkeys(":Cmd ab\<Tab>\<C-B>#\<CR>", 'xnt') |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
847 assert_equal('#Cmd abcd', @:) |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
848 END |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
849 v9.CheckScriptSuccess(lines) |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
850 |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
851 delcommand Cmd |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
852 delete('Xscript.vim') |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
853 enddef |
938c174b8088
patch 8.2.4755: cannot use <SID>FuncRef in completion spec
Bram Moolenaar <Bram@vim.org>
parents:
28453
diff
changeset
|
854 |
27285
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
855 def Test_use_autoload_import_in_insert_completion() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
856 mkdir('Xinsdir/autoload', 'p') |
27285
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
857 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
858 exe 'set rtp^=' .. getcwd() .. '/Xinsdir' |
27285
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
859 |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
860 var lines =<< trim END |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
861 vim9script |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
862 export def ThesaurusFunc(findbase: bool, _): any |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
863 if findbase |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
864 return 1 |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
865 endif |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
866 return [ |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
867 'check', |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
868 'experiment', |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
869 'test', |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
870 'verification' |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
871 ] |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
872 enddef |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
873 g:completion_loaded = 'yes' |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
874 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
875 writefile(lines, 'Xinsdir/autoload/completion.vim') |
27285
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
876 |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
877 new |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
878 lines =<< trim END |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
879 vim9script |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
880 g:completion_loaded = 'no' |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
881 import autoload 'completion.vim' |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
882 set thesaurusfunc=completion.ThesaurusFunc |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
883 assert_equal('no', g:completion_loaded) |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
884 feedkeys("i\<C-X>\<C-T>\<C-N>\<Esc>", 'xt') |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
885 assert_equal('experiment', getline(1)) |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
886 assert_equal('yes', g:completion_loaded) |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
887 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
888 v9.CheckScriptSuccess(lines) |
27285
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
889 |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
890 set thesaurusfunc= |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
891 bwipe! |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
892 delete('Xinsdir', 'rf') |
27285
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
893 &rtp = save_rtp |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
894 enddef |
53edd190a607
patch 8.2.4171: cannot invoke option function using autoload import
Bram Moolenaar <Bram@vim.org>
parents:
27277
diff
changeset
|
895 |
27362
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
896 def Test_use_autoload_import_partial_in_opfunc() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
897 mkdir('Xpartdir/autoload', 'p') |
27362
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
898 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
899 exe 'set rtp^=' .. getcwd() .. '/Xpartdir' |
27362
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
900 |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
901 var lines =<< trim END |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
902 vim9script |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
903 export def Opfunc1(..._) |
27362
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
904 g:opfunc_called = 'yes' |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
905 enddef |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
906 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
907 writefile(lines, 'Xpartdir/autoload/opfunc.vim') |
27362
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
908 |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
909 new |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
910 lines =<< trim END |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
911 vim9script |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
912 import autoload 'opfunc.vim' |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
913 nnoremap <expr> <F3> TheFunc() |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
914 def TheFunc(): string |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
915 &operatorfunc = function('opfunc.Opfunc1', [0]) |
27362
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
916 return 'g@' |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
917 enddef |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
918 feedkeys("\<F3>l", 'xt') |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
919 assert_equal('yes', g:opfunc_called) |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
920 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
921 v9.CheckScriptSuccess(lines) |
27362
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
922 |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
923 set opfunc= |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
924 bwipe! |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
925 delete('Xpartdir', 'rf') |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
926 nunmap <F3> |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
927 &rtp = save_rtp |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
928 enddef |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
929 |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
930 def Test_set_opfunc_to_autoload_func_directly() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
931 mkdir('Xdirdir/autoload', 'p') |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
932 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
933 exe 'set rtp^=' .. getcwd() .. '/Xdirdir' |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
934 |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
935 var lines =<< trim END |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
936 vim9script |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
937 export def Opfunc2(..._) |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
938 g:opfunc_called = 'yes' |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
939 enddef |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
940 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
941 writefile(lines, 'Xdirdir/autoload/opfunc.vim') |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
942 |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
943 new |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
944 lines =<< trim END |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
945 vim9script |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
946 import autoload 'opfunc.vim' |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
947 nnoremap <expr> <F3> TheFunc() |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
948 def TheFunc(): string |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
949 &operatorfunc = opfunc.Opfunc2 |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
950 return 'g@' |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
951 enddef |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
952 feedkeys("\<F3>l", 'xt') |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
953 assert_equal('yes', g:opfunc_called) |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
954 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
955 v9.CheckScriptSuccess(lines) |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
956 |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
957 set opfunc= |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
958 bwipe! |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
959 delete('Xdirdir', 'rf') |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27362
diff
changeset
|
960 nunmap <F3> |
27362
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
961 &rtp = save_rtp |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
962 enddef |
2ca6dd1f62af
patch 8.2.4209: partial in 'opfunc' cannot use an imported function
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
963 |
27289
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
964 def Test_use_autoload_import_in_fold_expression() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
965 mkdir('Xfolddir/autoload', 'p') |
27289
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
966 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
967 exe 'set rtp^=' .. getcwd() .. '/Xfolddir' |
27289
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
968 |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
969 var lines =<< trim END |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
970 vim9script |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
971 export def Expr(): string |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
972 return getline(v:lnum) =~ '^#' ? '>1' : '1' |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
973 enddef |
27301
ebe56a24acb6
patch 8.2.4179: 'foldtext' is evaluated in the current script context
Bram Moolenaar <Bram@vim.org>
parents:
27297
diff
changeset
|
974 export def Text(): string |
ebe56a24acb6
patch 8.2.4179: 'foldtext' is evaluated in the current script context
Bram Moolenaar <Bram@vim.org>
parents:
27297
diff
changeset
|
975 return 'fold text' |
ebe56a24acb6
patch 8.2.4179: 'foldtext' is evaluated in the current script context
Bram Moolenaar <Bram@vim.org>
parents:
27297
diff
changeset
|
976 enddef |
27289
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
977 g:fold_loaded = 'yes' |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
978 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
979 writefile(lines, 'Xfolddir/autoload/fold.vim') |
27289
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
980 |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
981 lines =<< trim END |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
982 vim9script |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
983 import autoload 'fold.vim' |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
984 &foldexpr = 'fold.Expr()' |
27301
ebe56a24acb6
patch 8.2.4179: 'foldtext' is evaluated in the current script context
Bram Moolenaar <Bram@vim.org>
parents:
27297
diff
changeset
|
985 &foldtext = 'fold.Text()' |
27289
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
986 &foldmethod = 'expr' |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
987 &debug = 'throw' |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
988 END |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
989 new |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
990 setline(1, ['# one', 'text', '# two', 'text']) |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
991 g:fold_loaded = 'no' |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
992 v9.CheckScriptSuccess(lines) |
27289
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
993 assert_equal('no', g:fold_loaded) |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
994 redraw |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
995 assert_equal('yes', g:fold_loaded) |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
996 |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
997 # Check that script context of 'foldexpr' is copied to another buffer. |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
998 edit! otherfile |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
999 redraw |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
1000 |
27301
ebe56a24acb6
patch 8.2.4179: 'foldtext' is evaluated in the current script context
Bram Moolenaar <Bram@vim.org>
parents:
27297
diff
changeset
|
1001 set foldexpr= foldtext& foldmethod& debug= |
27289
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
1002 bwipe! |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
1003 delete('Xfolddir', 'rf') |
27289
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
1004 &rtp = save_rtp |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
1005 enddef |
e11682ba8c80
patch 8.2.4173: cannot use an import in 'foldexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27285
diff
changeset
|
1006 |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1007 def Test_autoload_import_relative() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1008 var lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1009 vim9script |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1010 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1011 g:loaded = 'yes' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1012 export def RelFunc(): string |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1013 return 'relfunc' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1014 enddef |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1015 def NotExported() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1016 echo 'not' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1017 enddef |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1018 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1019 export var someText = 'some text' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1020 var notexp = 'bad' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1021 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1022 writefile(lines, 'XimportRel.vim') |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1023 writefile(lines, 'XimportRel2.vim') |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1024 writefile(lines, 'XimportRel3.vim') |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1025 writefile(lines, 'XimportRel4.vim') |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1026 writefile(lines, 'XimportRel5.vim') |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1027 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1028 lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1029 vim9script |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1030 g:loaded = 'no' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1031 import autoload './XimportRel.vim' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1032 assert_equal('no', g:loaded) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1033 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1034 def AFunc(): string |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1035 var res = '' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1036 res ..= XimportRel.RelFunc() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1037 res ..= '/' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1038 res ..= XimportRel.someText |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1039 XimportRel.someText = 'from AFunc' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1040 return res |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1041 enddef |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1042 # script not loaded when compiling |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1043 defcompile |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1044 assert_equal('no', g:loaded) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1045 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1046 assert_equal('relfunc/some text', AFunc()) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1047 assert_equal('yes', g:loaded) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1048 unlet g:loaded |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1049 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1050 assert_equal('from AFunc', XimportRel.someText) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1051 XimportRel.someText = 'from script' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1052 assert_equal('from script', XimportRel.someText) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1053 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1054 v9.CheckScriptSuccess(lines) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1055 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1056 lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1057 vim9script |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1058 import autoload './XimportRel.vim' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1059 echo XimportRel.NotExported() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1060 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1061 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: NotExported', 3) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1062 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1063 lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1064 vim9script |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1065 import autoload './XimportRel.vim' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1066 echo XimportRel.notexp |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1067 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1068 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 3) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1069 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1070 lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1071 vim9script |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1072 import autoload './XimportRel.vim' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1073 XimportRel.notexp = 'bad' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1074 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1075 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 3) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1076 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1077 lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1078 vim9script |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1079 import autoload './XimportRel.vim' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1080 def Func() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1081 echo XimportRel.NotExported() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1082 enddef |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1083 Func() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1084 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1085 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: NotExported', 1) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1086 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1087 lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1088 vim9script |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1089 import autoload './XimportRel.vim' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1090 def Func() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1091 echo XimportRel.notexp |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1092 enddef |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1093 Func() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1094 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1095 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 1) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1096 |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1097 # Same, script not imported before |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1098 lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1099 vim9script |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1100 import autoload './XimportRel4.vim' |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1101 def Func() |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1102 echo XimportRel4.notexp |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1103 enddef |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1104 Func() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1105 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1106 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 1) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1107 |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1108 # does not fail if the script wasn't loaded yet and only compiling |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1109 g:loaded = 'no' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1110 lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1111 vim9script |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1112 import autoload './XimportRel2.vim' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1113 def Func() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1114 echo XimportRel2.notexp |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1115 enddef |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1116 defcompile |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1117 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1118 v9.CheckScriptSuccess(lines) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1119 assert_equal('no', g:loaded) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1120 |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1121 lines =<< trim END |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1122 vim9script |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1123 import autoload './XimportRel.vim' |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1124 def Func() |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1125 XimportRel.notexp = 'bad' |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1126 enddef |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1127 Func() |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1128 END |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1129 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 1) |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1130 |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1131 # fails with a not loaded import |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1132 lines =<< trim END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1133 vim9script |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1134 import autoload './XimportRel3.vim' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1135 def Func() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1136 XimportRel3.notexp = 'bad' |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1137 enddef |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1138 Func() |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1139 END |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1140 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 1) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1141 assert_equal('yes', g:loaded) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1142 unlet g:loaded |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1143 |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1144 lines =<< trim END |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1145 vim9script |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1146 import autoload './XimportRel5.vim' |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1147 def Func() |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1148 XimportRel5.nosuchvar = 'bad' |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1149 enddef |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1150 Func() |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1151 END |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1152 v9.CheckScriptFailure(lines, 'E121: Undefined variable: nosuchvar', 1) |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1153 unlet g:loaded |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1154 |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1155 # nasty: delete script after compiling function |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1156 writefile(['vim9script'], 'XimportRelDel.vim') |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1157 lines =<< trim END |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1158 vim9script |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1159 |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1160 import autoload './XimportRelDel.vim' |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1161 def DoIt() |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1162 echo XimportRelDel.var |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1163 enddef |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1164 defcompile |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1165 delete('XimportRelDel.vim') |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1166 DoIt() |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1167 END |
28309
62689b6765d6
patch 8.2.4680: build failure without +postscript
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
1168 v9.CheckScriptFailure(lines, 'E484:') |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1169 |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1170 delete('XimportRel.vim') |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1171 delete('XimportRel2.vim') |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1172 delete('XimportRel3.vim') |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1173 delete('XimportRel4.vim') |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1174 delete('XimportRel5.vim') |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1175 enddef |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28162
diff
changeset
|
1176 |
28261
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1177 def Test_autoload_import_relative_autoload_dir() |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1178 mkdir('autoload', 'p') |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1179 var lines =<< trim END |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1180 vim9script |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1181 export def Bar() |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1182 g:called_bar = 'yes' |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1183 enddef |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1184 END |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1185 writefile(lines, 'autoload/script.vim') |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1186 |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1187 lines =<< trim END |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1188 vim9script |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1189 import autoload './autoload/script.vim' |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1190 def Foo() |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1191 script.Bar() |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1192 enddef |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1193 Foo() |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1194 assert_equal('yes', g:called_bar) |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1195 END |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1196 v9.CheckScriptSuccess(lines) |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1197 |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1198 unlet g:called_bar |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1199 delete('autoload', 'rf') |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1200 enddef |
20f6b0cdf38c
patch 8.2.4656: Vim9: can't use item from "import autoload" with autoload dir
Bram Moolenaar <Bram@vim.org>
parents:
28255
diff
changeset
|
1201 |
28594
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1202 def Test_autoload_import_deleted() |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1203 var lines =<< trim END |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1204 vim9script |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1205 export const FOO = 1 |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1206 END |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1207 writefile(lines, 'Xa.vim') |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1208 |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1209 lines =<< trim END |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1210 vim9script |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1211 import autoload './Xa.vim' |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1212 |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1213 delete('Xa.vim') |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1214 var x = Xa.FOO |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1215 END |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1216 v9.CheckScriptFailure(lines, 'E484:') |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1217 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
1218 delete('Xa.vim') |
28594
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1219 enddef |
294771aab3ae
patch 8.2.4821: crash when imported autoload script was deleted
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
1220 |
30819
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1221 def Test_autoload_import_using_const() |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1222 mkdir('Xdir/autoload', 'pR') |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1223 var lines =<< trim END |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1224 vim9script |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1225 export const FOO = 42 |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1226 echomsg FOO |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1227 END |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1228 writefile(lines, 'Xdir/autoload/exp.vim') |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1229 |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1230 var save_rtp = &rtp |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1231 exe 'set rtp^=' .. getcwd() .. '/Xdir' |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1232 lines =<< trim END |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1233 vim9script |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1234 import autoload 'exp.vim' |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1235 assert_equal(42, exp.FOO) |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1236 END |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1237 v9.CheckScriptSuccess(lines) |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1238 &rtp = save_rtp |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1239 enddef |
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
1240 |
27305
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1241 func Test_import_in_diffexpr() |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1242 CheckExecutable diff |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1243 |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1244 call Run_Test_import_in_diffexpr() |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1245 endfunc |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1246 |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1247 def Run_Test_import_in_diffexpr() |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1248 var lines =<< trim END |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1249 vim9script |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1250 |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1251 export def DiffExpr() |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1252 # Prepend some text to check diff type detection |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1253 writefile(['warning', ' message'], v:fname_out) |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1254 silent exe '!diff ' .. v:fname_in .. ' ' |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1255 .. v:fname_new .. '>>' .. v:fname_out |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1256 enddef |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1257 END |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1258 writefile(lines, 'Xdiffexpr') |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1259 |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1260 lines =<< trim END |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1261 vim9script |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1262 import './Xdiffexpr' as diff |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1263 |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1264 set diffexpr=diff.DiffExpr() |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1265 set diffopt=foldcolumn:0 |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1266 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1267 v9.CheckScriptSuccess(lines) |
27305
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1268 |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1269 enew! |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1270 call setline(1, ['one', 'two', 'three']) |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1271 diffthis |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1272 |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1273 botright vert new |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1274 call setline(1, ['one', 'two', 'three.']) |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1275 diffthis |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1276 # we only check if this does not cause errors |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1277 redraw |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1278 |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1279 diffoff! |
29297
8890460143c9
patch 8.2.5165: import test fails because 'diffexpr' isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
29006
diff
changeset
|
1280 set diffexpr= |
8890460143c9
patch 8.2.5165: import test fails because 'diffexpr' isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
29006
diff
changeset
|
1281 set diffopt& |
27305
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1282 bwipe! |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1283 bwipe! |
27344
44e82999b4e1
patch 8.2.4200: some tests do not clean up properly
Bram Moolenaar <Bram@vim.org>
parents:
27338
diff
changeset
|
1284 delete('Xdiffexpr') |
27305
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1285 enddef |
30d8437ad7cc
patch 8.2.4181: Vim9: cannot use an import in 'diffexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27301
diff
changeset
|
1286 |
27315
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1287 def Test_import_in_patchexpr() |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1288 var lines =<< trim END |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1289 vim9script |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1290 export def TPatch() |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1291 call writefile(['output file'], v:fname_out) |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1292 enddef |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1293 END |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1294 writefile(lines, 'Xpatchexpr') |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1295 |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1296 lines =<< trim END |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1297 vim9script |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1298 import './Xpatchexpr' as patch |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1299 set patchexpr=patch.TPatch() |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1300 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1301 v9.CheckScriptSuccess(lines) |
27315
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1302 |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1303 call writefile(['input file'], 'Xinput') |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1304 call writefile(['diff file'], 'Xdiff') |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1305 :%bwipe! |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1306 edit Xinput |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1307 diffpatch Xdiff |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1308 call assert_equal('output file', getline(1)) |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1309 |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1310 call delete('Xinput') |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1311 call delete('Xdiff') |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1312 call delete('Xpatchexpr') |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1313 set patchexpr& |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1314 :%bwipe! |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1315 enddef |
a195a900a329
patch 8.2.4186: cannot use an import in 'patchexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27313
diff
changeset
|
1316 |
27309
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1317 def Test_import_in_formatexpr() |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1318 var lines =<< trim END |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1319 vim9script |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1320 export def MyFormatExpr(): number |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1321 g:did_format = 'yes' |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1322 return 0 |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1323 enddef |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1324 END |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1325 writefile(lines, 'Xformatter') |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1326 |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1327 lines =<< trim END |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1328 vim9script |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1329 import './Xformatter' as format |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1330 set formatexpr=format.MyFormatExpr() |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1331 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1332 v9.CheckScriptSuccess(lines) |
27309
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1333 |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1334 new |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1335 setline(1, ['a', 'b', 'c']) |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1336 normal gqG |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1337 assert_equal('yes', g:did_format) |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1338 |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1339 bwipe! |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1340 delete('Xformatter') |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1341 unlet g:did_format |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1342 set formatexpr= |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1343 enddef |
391011658d95
patch 8.2.4183: cannot use an import in 'formatexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27305
diff
changeset
|
1344 |
27311
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1345 def Test_import_in_includeexpr() |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1346 writefile(['found it'], 'Xthisfile') |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1347 new |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1348 |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1349 var lines =<< trim END |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1350 vim9script |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1351 export def DoSub(): string |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1352 return substitute(v:fname, 'that', 'this', '') |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1353 enddef |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1354 END |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1355 writefile(lines, 'Xinclude.vim') |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1356 |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1357 lines =<< trim END |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1358 vim9script |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1359 import './Xinclude.vim' |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1360 set includeexpr=Xinclude.DoSub() |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1361 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1362 v9.CheckScriptSuccess(lines) |
27311
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1363 |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1364 setline(1, ['Xthatfile']) |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1365 exe "normal \<C-W>f" |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1366 assert_equal('Xthisfile', expand('%')) |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1367 |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1368 bwipe! |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1369 bwipe! |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1370 set includeexpr= |
27344
44e82999b4e1
patch 8.2.4200: some tests do not clean up properly
Bram Moolenaar <Bram@vim.org>
parents:
27338
diff
changeset
|
1371 delete('Xinclude.vim') |
27311
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1372 delete('Xthisfile') |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1373 enddef |
b3ef31c6a922
patch 8.2.4184: cannot use an import in 'includeexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27309
diff
changeset
|
1374 |
27313
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1375 def Test_import_in_indentexpr() |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1376 var lines =<< trim END |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1377 vim9script |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1378 export def GetIndent(): number |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1379 return 5 |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1380 enddef |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1381 END |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1382 writefile(lines, 'Xindenter') |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1383 |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1384 lines =<< trim END |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1385 vim9script |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1386 import './Xindenter' as indent |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1387 set indentexpr=indent.GetIndent() |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1388 set debug=throw |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1389 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1390 v9.CheckScriptSuccess(lines) |
27313
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1391 |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1392 new |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1393 setline(1, 'hello') |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1394 normal == |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1395 assert_equal(' hello', getline(1)) |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1396 |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1397 bwipe! |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1398 set indentexpr= debug= |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1399 delete('Xindenter') |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1400 enddef |
748ab01dbdc5
patch 8.2.4185: cannot use an import in 'indentexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27311
diff
changeset
|
1401 |
27328
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1402 func Test_import_in_printexpr() |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1403 CheckFeature postscript |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1404 call Run_Test_import_in_printexpr() |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1405 endfunc |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1406 |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1407 def Run_Test_import_in_printexpr() |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1408 var lines =<< trim END |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1409 vim9script |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1410 export def PrintFile(): bool |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1411 g:printed = 'yes' |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1412 delete('v:fname_in') |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1413 return false |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1414 enddef |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1415 END |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1416 writefile(lines, 'Xprint.vim') |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1417 |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1418 lines =<< trim END |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1419 vim9script |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1420 import './Xprint.vim' |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1421 set printexpr=Xprint.PrintFile() |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1422 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1423 v9.CheckScriptSuccess(lines) |
27328
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1424 |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1425 help |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1426 hardcopy dummy args |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1427 assert_equal('yes', g:printed) |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1428 |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1429 delete('Xprint.vim') |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1430 set printexpr= |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1431 enddef |
7382135dac01
patch 8.2.4192: cannot use an import in 'printexpr'
Bram Moolenaar <Bram@vim.org>
parents:
27315
diff
changeset
|
1432 |
27330
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1433 def Test_import_in_charconvert() |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1434 var lines =<< trim END |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1435 vim9script |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1436 export def MakeUpper(): bool |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1437 var data = readfile(v:fname_in) |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1438 map(data, 'toupper(v:val)') |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1439 writefile(data, v:fname_out) |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1440 return false # success |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1441 enddef |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1442 END |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1443 writefile(lines, 'Xconvert.vim') |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1444 |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1445 lines =<< trim END |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1446 vim9script |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1447 import './Xconvert.vim' as conv |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1448 set charconvert=conv.MakeUpper() |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1449 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1450 v9.CheckScriptSuccess(lines) |
27330
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1451 |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
1452 writefile(['one', 'two'], 'Xiicfile') |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
1453 new Xiicfile |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
1454 write ++enc=ucase Xiicfile1 |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
1455 assert_equal(['ONE', 'TWO'], readfile('Xiicfile1')) |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
1456 |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
1457 delete('Xiicfile') |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
1458 delete('Xiicfile1') |
27330
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1459 delete('Xconvert.vim') |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1460 bwipe! |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1461 set charconvert& |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1462 enddef |
aeadf4315bef
patch 8.2.4193: cannot use an import in 'charconvert'
Bram Moolenaar <Bram@vim.org>
parents:
27328
diff
changeset
|
1463 |
27338
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1464 func Test_import_in_spellsuggest_expr() |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1465 CheckFeature spell |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1466 call Run_Test_import_in_spellsuggest_expr() |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1467 endfunc |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1468 |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1469 def Run_Test_import_in_spellsuggest_expr() |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1470 var lines =<< trim END |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1471 vim9script |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1472 export def MySuggest(): list<any> |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1473 return [['Fox', 8], ['Fop', 9]] |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1474 enddef |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1475 END |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1476 writefile(lines, 'Xsuggest.vim') |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1477 |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1478 lines =<< trim END |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1479 vim9script |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1480 import './Xsuggest.vim' as sugg |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1481 set spell spellsuggest=expr:sugg.MySuggest() |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1482 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1483 v9.CheckScriptSuccess(lines) |
27338
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1484 |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1485 set verbose=1 # report errors |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1486 call assert_equal(['Fox', 'Fop'], spellsuggest('Fo', 2)) |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1487 |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1488 delete('Xsuggest.vim') |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1489 set nospell spellsuggest& verbose=0 |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1490 enddef |
c62006deb5c1
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Bram Moolenaar <Bram@vim.org>
parents:
27330
diff
changeset
|
1491 |
30057
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1492 def Test_import_in_lambda_method() |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1493 var lines =<< trim END |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1494 vim9script |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1495 export def Retarg(e: any): any |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1496 return e |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1497 enddef |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1498 END |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1499 writefile(lines, 'XexportRetarg.vim') |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1500 lines =<< trim END |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1501 vim9script |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1502 import './XexportRetarg.vim' |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1503 def Lambda(): string |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1504 var F = (x) => x->XexportRetarg.Retarg() |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1505 return F('arg') |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1506 enddef |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1507 assert_equal('arg', Lambda()) |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1508 END |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1509 v9.CheckScriptSuccess(lines) |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1510 |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1511 delete('XexportRetarg.vim') |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1512 enddef |
9c141768fa0f
patch 9.0.0366: cannot use import->Func() in lambda
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1513 |
27348
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1514 def Test_export_shadows_global_function() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
1515 mkdir('Xglobdir/autoload', 'p') |
27348
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1516 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
1517 exe 'set rtp^=' .. getcwd() .. '/Xglobdir' |
27348
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1518 |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1519 var lines =<< trim END |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1520 vim9script |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1521 export def Shadow(): string |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1522 return 'Shadow()' |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1523 enddef |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1524 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
1525 writefile(lines, 'Xglobdir/autoload/shadow.vim') |
27348
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1526 |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1527 lines =<< trim END |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1528 vim9script |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1529 |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1530 def g:Shadow(): string |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1531 return 'global' |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1532 enddef |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1533 |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1534 import autoload 'shadow.vim' |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1535 assert_equal('Shadow()', shadow.Shadow()) |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1536 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1537 v9.CheckScriptSuccess(lines) |
27348
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1538 |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1539 delfunc g:Shadow |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1540 bwipe! |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
1541 delete('Xglobdir', 'rf') |
27348
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1542 &rtp = save_rtp |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1543 enddef |
9a9c34c84cd4
patch 8.2.4202: Vim9: cannot export function that exists globally
Bram Moolenaar <Bram@vim.org>
parents:
27344
diff
changeset
|
1544 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1545 def Test_export_fails() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1546 v9.CheckScriptFailure(['export var some = 123'], 'E1042:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1547 v9.CheckScriptFailure(['vim9script', 'export var g:some'], 'E1022:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1548 v9.CheckScriptFailure(['vim9script', 'export echo 134'], 'E1043:') |
28570
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
1549 v9.CheckScriptFailure(['vim9script', 'export function /a1b2c3'], 'E1044:') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1550 |
30705
12e6c7bae2a9
patch 9.0.0687: "export def" does not work in a nested block
Bram Moolenaar <Bram@vim.org>
parents:
30057
diff
changeset
|
1551 assert_fails('export echo 1', 'E1043:') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1552 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1553 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1554 func Test_import_fails_without_script() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1555 CheckRunVimInTerminal |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1556 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1557 " call indirectly to avoid compilation error for missing functions |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1558 call Run_Test_import_fails_on_command_line() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1559 endfunc |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1560 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1561 def Run_Test_import_fails_on_command_line() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1562 var export =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1563 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1564 export def Foo(): number |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1565 return 0 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1566 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1567 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1568 writefile(export, 'XexportCmd.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1569 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1570 var buf = g:RunVimInTerminal('-c "import Foo from ''./XexportCmd.vim''"', { |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1571 rows: 6, wait_for_ruler: 0}) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1572 g:WaitForAssert(() => assert_match('^E1094:', term_getline(buf, 5))) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1573 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1574 delete('XexportCmd.vim') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1575 g:StopVimInTerminal(buf) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1576 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1577 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1578 def Test_vim9_reload_noclear() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1579 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1580 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1581 export var exported = 'thexport' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1582 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1583 export def TheFunc(x = 0) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1584 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1585 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1586 writefile(lines, 'XExportReload') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1587 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1588 vim9script noclear |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1589 g:loadCount += 1 |
27669
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27607
diff
changeset
|
1590 var reloaded = 'init' |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1591 import './XExportReload' as exp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1592 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1593 def Again(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1594 return 'again' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1595 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1596 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1597 exp.TheFunc() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1598 |
27669
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27607
diff
changeset
|
1599 if exists('loaded') | finish | endif |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27607
diff
changeset
|
1600 var loaded = true |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1601 |
27669
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27607
diff
changeset
|
1602 var notReloaded = 'yes' |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27607
diff
changeset
|
1603 reloaded = 'first' |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1604 def g:Values(): list<string> |
27669
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27607
diff
changeset
|
1605 return [reloaded, notReloaded, Again(), Once(), exp.exported] |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1606 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1607 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1608 def Once(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1609 return 'once' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1610 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1611 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1612 writefile(lines, 'XReloaded') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1613 g:loadCount = 0 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1614 source XReloaded |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1615 assert_equal(1, g:loadCount) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1616 assert_equal(['first', 'yes', 'again', 'once', 'thexport'], g:Values()) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1617 source XReloaded |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1618 assert_equal(2, g:loadCount) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1619 assert_equal(['init', 'yes', 'again', 'once', 'thexport'], g:Values()) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1620 source XReloaded |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1621 assert_equal(3, g:loadCount) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1622 assert_equal(['init', 'yes', 'again', 'once', 'thexport'], g:Values()) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1623 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1624 delete('XReloaded') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1625 delete('XExportReload') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1626 delfunc g:Values |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1627 unlet g:loadCount |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1628 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1629 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1630 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1631 def Inner() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1632 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1633 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1634 lines->writefile('XreloadScript.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1635 source XreloadScript.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1636 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1637 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1638 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1639 def Outer() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1640 def Inner() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1641 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1642 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1643 defcompile |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1644 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1645 lines->writefile('XreloadScript.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1646 source XreloadScript.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1647 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1648 delete('XreloadScript.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1649 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1650 |
27756
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1651 def Test_vim_reload_noclear_arg_count() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1652 var lines =<< trim END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1653 vim9script noclear |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1654 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1655 if !exists('g:didload') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1656 def Test(a: string, b: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1657 echo a b |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1658 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1659 def Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1660 Test('a', 'b') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1661 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1662 else |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1663 # redefine with one argument less |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1664 def Test(a: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1665 echo a |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1666 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1667 endif |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1668 Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1669 g:didload = 1 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1670 END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1671 lines->writefile('XreloadScript_1.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1672 source XreloadScript_1.vim |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1673 assert_fails('source XreloadScript_1.vim', 'E1106: One argument too many') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1674 unlet g:didload |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1675 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1676 lines =<< trim END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1677 vim9script noclear |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1678 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1679 if !exists('g:didload') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1680 def Test(a: string, b: string, c: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1681 echo a b |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1682 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1683 def Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1684 Test('a', 'b', 'c') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1685 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1686 else |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1687 # redefine with one argument less |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1688 def Test(a: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1689 echo a |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1690 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1691 endif |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1692 Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1693 g:didload = 1 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1694 END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1695 lines->writefile('XreloadScript_2.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1696 source XreloadScript_2.vim |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1697 assert_fails('source XreloadScript_2.vim', 'E1106: 2 arguments too many') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1698 unlet g:didload |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1699 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1700 lines =<< trim END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1701 vim9script noclear |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1702 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1703 if !exists('g:didload') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1704 def Test(a: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1705 echo a |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1706 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1707 def Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1708 Test('a') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1709 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1710 else |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1711 # redefine with one argument extra |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1712 def Test(a: string, b: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1713 echo a b |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1714 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1715 endif |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1716 Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1717 g:didload = 1 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1718 END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1719 lines->writefile('XreloadScript_3.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1720 source XreloadScript_3.vim |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1721 assert_fails('source XreloadScript_3.vim', 'E1190: One argument too few') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1722 unlet g:didload |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1723 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1724 lines =<< trim END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1725 vim9script noclear |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1726 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1727 if !exists('g:didload') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1728 def Test(a: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1729 echo a |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1730 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1731 def Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1732 Test('a') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1733 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1734 else |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1735 # redefine with two arguments extra |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1736 def Test(a: string, b: string, c: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1737 echo a b |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1738 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1739 endif |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1740 Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1741 g:didload = 1 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1742 END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1743 lines->writefile('XreloadScript_4.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1744 source XreloadScript_4.vim |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1745 assert_fails('source XreloadScript_4.vim', 'E1190: 2 arguments too few') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1746 unlet g:didload |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1747 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1748 delete('XreloadScript_1.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1749 delete('XreloadScript_2.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1750 delete('XreloadScript_3.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1751 delete('XreloadScript_4.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1752 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1753 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1754 def Test_vim9_reload_noclear_error() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1755 var lines =<< trim END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1756 vim9script noclear |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1757 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1758 if !exists('g:didload') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1759 def Test(a: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1760 echo a |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1761 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1762 def Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1763 Test('a') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1764 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1765 else |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1766 # redefine with a compile error |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1767 def Test(a: string) |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1768 echo ax |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1769 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1770 endif |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1771 Call() |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1772 g:didload = 1 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1773 END |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1774 lines->writefile('XreloadScriptErr.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1775 source XreloadScriptErr.vim |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1776 assert_fails('source XreloadScriptErr.vim', 'E1001: Variable not found: ax') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1777 |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1778 unlet g:didload |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1779 delete('XreloadScriptErr.vim') |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1780 enddef |
60ac4228a73d
patch 8.2.4404: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
1781 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1782 def Test_vim9_reload_import() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1783 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1784 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1785 const var = '' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1786 var valone = 1234 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1787 def MyFunc(arg: string) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1788 valone = 5678 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1789 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1790 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1791 var morelines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1792 var valtwo = 222 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1793 export def GetValtwo(): number |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1794 return valtwo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1795 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1796 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1797 writefile(lines + morelines, 'Xreload.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1798 source Xreload.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1799 source Xreload.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1800 source Xreload.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1801 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1802 # cannot declare a var twice |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1803 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1804 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1805 var valone = 1234 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1806 var valone = 5678 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1807 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1808 writefile(lines, 'Xreload.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1809 assert_fails('source Xreload.vim', 'E1041:', '', 3, 'Xreload.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1810 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1811 delete('Xreload.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1812 delete('Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1813 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1814 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1815 " if a script is reloaded with a script-local variable that changed its type, a |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1816 " compiled function using that variable must fail. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1817 def Test_script_reload_change_type() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1818 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1819 vim9script noclear |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1820 var str = 'string' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1821 def g:GetStr(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1822 return str .. 'xxx' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1823 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1824 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1825 writefile(lines, 'Xreload.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1826 source Xreload.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1827 echo g:GetStr() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1828 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1829 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1830 vim9script noclear |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1831 var str = 1234 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1832 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1833 writefile(lines, 'Xreload.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1834 source Xreload.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1835 assert_fails('echo g:GetStr()', 'E1150:') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1836 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1837 delfunc g:GetStr |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1838 delete('Xreload.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1839 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1840 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1841 " Define CallFunc so that the test can be compiled |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1842 command CallFunc echo 'nop' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1843 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1844 def Test_script_reload_from_function() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1845 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1846 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1847 |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1848 if exists('g:loadedThis') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1849 finish |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1850 endif |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1851 g:loadedThis = 1 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1852 delcommand CallFunc |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1853 command CallFunc Func() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1854 def Func() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1855 so XreloadFunc.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1856 g:didTheFunc = 1 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1857 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1858 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1859 writefile(lines, 'XreloadFunc.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1860 source XreloadFunc.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1861 CallFunc |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1862 assert_equal(1, g:didTheFunc) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1863 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1864 delete('XreloadFunc.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1865 delcommand CallFunc |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1866 unlet g:loadedThis |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1867 unlet g:didTheFunc |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1868 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1869 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1870 def s:RetSome(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1871 return 'some' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1872 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1873 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1874 " Not exported function that is referenced needs to be accessed by the |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1875 " script-local name. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1876 def Test_vim9_funcref() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1877 var sortlines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1878 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1879 def Compare(i1: number, i2: number): number |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1880 return i2 - i1 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1881 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1882 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1883 export def FastSort(): list<number> |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1884 return range(5)->sort(Compare) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1885 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1886 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1887 export def GetString(arg: string): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1888 return arg |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1889 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1890 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1891 writefile(sortlines, 'Xsort.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1892 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1893 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1894 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1895 import './Xsort.vim' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1896 def Test() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1897 g:result = Xsort.FastSort() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1898 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1899 Test() |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
1900 END |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
1901 writefile(lines, 'Xscript.vim') |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
1902 source Xscript.vim |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
1903 assert_equal([4, 3, 2, 1, 0], g:result) |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
1904 unlet g:result |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1905 |
27030
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
1906 lines =<< trim END |
c8809b8d19de
patch 8.2.4044: Vim9: no error when importing the same script twice
Bram Moolenaar <Bram@vim.org>
parents:
27014
diff
changeset
|
1907 vim9script |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1908 # using a function imported with "as" |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1909 import './Xsort.vim' as anAlias |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1910 assert_equal('yes', anAlias.GetString('yes')) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1911 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1912 # using the function from a compiled function |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1913 def TestMore(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1914 var s = s:anAlias.GetString('foo') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1915 return s .. anAlias.GetString('bar') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1916 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1917 assert_equal('foobar', TestMore()) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1918 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1919 # error when using a function that isn't exported |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1920 assert_fails('anAlias.Compare(1, 2)', 'E1049:') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1921 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1922 writefile(lines, 'Xscript.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1923 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1924 delete('Xsort.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1925 delete('Xscript.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1926 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1927 var Funcref = function('s:RetSome') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1928 assert_equal('some', Funcref()) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1929 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1930 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1931 " Check that when searching for "FilterFunc" it finds the import in the |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1932 " script where FastFilter() is called from, both as a string and as a direct |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1933 " function reference. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1934 def Test_vim9_funcref_other_script() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1935 var filterLines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1936 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1937 export def FilterFunc(idx: number, val: number): bool |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1938 return idx % 2 == 1 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1939 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1940 export def FastFilter(): list<number> |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1941 return range(10)->filter('FilterFunc(v:key, v:val)') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1942 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1943 export def FastFilterDirect(): list<number> |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1944 return range(10)->filter(FilterFunc) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1945 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1946 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1947 writefile(filterLines, 'Xfilter.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1948 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1949 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1950 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1951 import './Xfilter.vim' as filter |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1952 def Test() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1953 var x: list<number> = filter.FastFilter() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1954 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1955 Test() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1956 def TestDirect() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1957 var x: list<number> = filter.FastFilterDirect() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1958 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1959 TestDirect() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1960 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1961 v9.CheckScriptSuccess(lines) |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1962 delete('Xfilter.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1963 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1964 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1965 def Test_import_absolute() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1966 var import_lines = [ |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1967 'vim9script', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1968 'import "' .. escape(getcwd(), '\') .. '/Xexport_abs.vim" as abs', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1969 'def UseExported()', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1970 ' g:imported_abs = abs.exported', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1971 ' abs.exported = 8888', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1972 ' g:imported_after = abs.exported', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1973 'enddef', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1974 'UseExported()', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1975 'g:import_disassembled = execute("disass UseExported")', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1976 ] |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1977 writefile(import_lines, 'Ximport_abs.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1978 writefile(s:export_script_lines, 'Xexport_abs.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1979 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1980 source Ximport_abs.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1981 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1982 assert_equal(9876, g:imported_abs) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1983 assert_equal(8888, g:imported_after) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1984 assert_match('<SNR>\d\+_UseExported\_s*' .. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1985 'g:imported_abs = abs.exported\_s*' .. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1986 '0 LOADSCRIPT exported-2 from .*Xexport_abs.vim\_s*' .. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1987 '1 STOREG g:imported_abs\_s*' .. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1988 'abs.exported = 8888\_s*' .. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1989 '2 PUSHNR 8888\_s*' .. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1990 '3 STORESCRIPT exported-2 in .*Xexport_abs.vim\_s*' .. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1991 'g:imported_after = abs.exported\_s*' .. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1992 '4 LOADSCRIPT exported-2 from .*Xexport_abs.vim\_s*' .. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1993 '5 STOREG g:imported_after', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1994 g:import_disassembled) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1995 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1996 Undo_export_script_lines() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1997 unlet g:imported_abs |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1998 unlet g:import_disassembled |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1999 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2000 delete('Ximport_abs.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2001 delete('Xexport_abs.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2002 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2003 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2004 def Test_import_rtp() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2005 var import_lines = [ |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2006 'vim9script', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2007 'import "Xexport_rtp.vim" as rtp', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2008 'g:imported_rtp = rtp.exported', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2009 ] |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2010 writefile(import_lines, 'Ximport_rtp.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2011 mkdir('import', 'p') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2012 writefile(s:export_script_lines, 'import/Xexport_rtp.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2013 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2014 var save_rtp = &rtp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2015 &rtp = getcwd() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2016 source Ximport_rtp.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2017 &rtp = save_rtp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2018 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2019 assert_equal(9876, g:imported_rtp) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2020 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2021 Undo_export_script_lines() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2022 unlet g:imported_rtp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2023 delete('Ximport_rtp.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2024 delete('import', 'rf') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2025 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2026 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2027 def Test_import_compile_error() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2028 var export_lines = [ |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2029 'vim9script', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2030 'export def ExpFunc(): string', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2031 ' return notDefined', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2032 'enddef', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2033 ] |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2034 writefile(export_lines, 'Xexported.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2035 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2036 var import_lines = [ |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2037 'vim9script', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2038 'import "./Xexported.vim" as expo', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2039 'def ImpFunc()', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2040 ' echo expo.ExpFunc()', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2041 'enddef', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2042 'defcompile', |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2043 ] |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2044 writefile(import_lines, 'Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2045 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2046 try |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2047 source Ximport.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2048 catch /E1001/ |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2049 # Error should be before the Xexported.vim file. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2050 assert_match('E1001: Variable not found: notDefined', v:exception) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2051 assert_match('function <SNR>\d\+_ImpFunc\[1\]..<SNR>\d\+_ExpFunc, line 1', v:throwpoint) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2052 endtry |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2053 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2054 delete('Xexported.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2055 delete('Ximport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2056 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2057 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2058 def Test_func_overrules_import_fails() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2059 var export_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2060 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2061 export def Func() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2062 echo 'imported' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2063 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2064 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2065 writefile(export_lines, 'XexportedFunc.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2066 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2067 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2068 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2069 import './XexportedFunc.vim' as Func |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2070 def Func() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2071 echo 'local to function' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2072 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2073 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2074 v9.CheckScriptFailure(lines, 'E1213: Redefining imported item "Func"') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2075 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2076 lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2077 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2078 import './XexportedFunc.vim' as Func |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2079 def Outer() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2080 def Func() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2081 echo 'local to function' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2082 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2083 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2084 defcompile |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2085 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2086 v9.CheckScriptFailure(lines, 'E1236:') |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2087 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2088 delete('XexportedFunc.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2089 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2090 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2091 def Test_source_vim9_from_legacy() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2092 var vim9_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2093 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2094 var local = 'local' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2095 g:global = 'global' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2096 export var exported = 'exported' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2097 export def GetText(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2098 return 'text' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2099 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2100 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2101 writefile(vim9_lines, 'Xvim9_script.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2102 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2103 var legacy_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2104 source Xvim9_script.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2105 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2106 call assert_false(exists('local')) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2107 call assert_false(exists('exported')) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2108 call assert_false(exists('s:exported')) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2109 call assert_equal('global', global) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2110 call assert_equal('global', g:global) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2111 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2112 writefile(legacy_lines, 'Xlegacy_script.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2113 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2114 source Xlegacy_script.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2115 assert_equal('global', g:global) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2116 unlet g:global |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2117 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2118 delete('Xlegacy_script.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2119 delete('Xvim9_script.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2120 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2121 |
27112
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2122 def Test_import_vim9_from_legacy() |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2123 var vim9_lines =<< trim END |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2124 vim9script |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2125 var local = 'local' |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2126 g:global = 'global' |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2127 export var exported = 'exported' |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2128 export def GetText(): string |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2129 return 'text' |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2130 enddef |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2131 END |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2132 writefile(vim9_lines, 'Xvim9_export.vim') |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2133 |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2134 var legacy_lines =<< trim END |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2135 import './Xvim9_export.vim' as vim9 |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2136 |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2137 call assert_false(exists('vim9')) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2138 call assert_false(exists('local')) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2139 call assert_false(exists('s:vim9.local')) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2140 call assert_equal('global', global) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2141 call assert_equal('global', g:global) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2142 call assert_false(exists('exported')) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2143 call assert_false(exists('s:exported')) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2144 call assert_false(exists('*GetText')) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2145 |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2146 " imported symbol is script-local |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2147 call assert_equal('exported', s:vim9.exported) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2148 call assert_equal('text', s:vim9.GetText()) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2149 END |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2150 writefile(legacy_lines, 'Xlegacy_script.vim') |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2151 |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2152 source Xlegacy_script.vim |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2153 assert_equal('global', g:global) |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2154 unlet g:global |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2155 |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2156 delete('Xlegacy_script.vim') |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2157 delete('Xvim9_export.vim') |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2158 enddef |
60df9f2679a6
patch 8.2.4085: Vim9: no test for using import in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
27108
diff
changeset
|
2159 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2160 def Test_cmdline_win() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2161 # if the Vim syntax highlighting uses Vim9 constructs they can be used from |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2162 # the command line window. |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2163 mkdir('rtp/syntax', 'p') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2164 var export_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2165 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2166 export var That = 'yes' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2167 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2168 writefile(export_lines, 'rtp/syntax/Xexport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2169 var import_lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2170 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2171 import './Xexport.vim' as exp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2172 echo exp.That |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2173 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2174 writefile(import_lines, 'rtp/syntax/vim.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2175 var save_rtp = &rtp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2176 &rtp = getcwd() .. '/rtp' .. ',' .. &rtp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2177 syntax on |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2178 augroup CmdWin |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2179 autocmd CmdwinEnter * g:got_there = 'yes' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2180 augroup END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2181 # this will open and also close the cmdline window |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2182 feedkeys('q:', 'xt') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2183 assert_equal('yes', g:got_there) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2184 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2185 augroup CmdWin |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2186 au! |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2187 augroup END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2188 &rtp = save_rtp |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2189 delete('rtp', 'rf') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2190 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2191 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2192 def Test_import_gone_when_sourced_twice() |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2193 var exportlines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2194 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2195 if exists('g:guard') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2196 finish |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2197 endif |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2198 g:guard = 1 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2199 export var name = 'someName' |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2200 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2201 writefile(exportlines, 'XexportScript.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2202 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2203 var lines =<< trim END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2204 vim9script |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2205 import './XexportScript.vim' as expo |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2206 def g:GetName(): string |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2207 return expo.name |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2208 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2209 END |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2210 writefile(lines, 'XscriptImport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2211 so XscriptImport.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2212 assert_equal('someName', g:GetName()) |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2213 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2214 so XexportScript.vim |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2215 assert_fails('call g:GetName()', 'E1149:') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2216 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2217 delfunc g:GetName |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2218 delete('XexportScript.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2219 delete('XscriptImport.vim') |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2220 unlet g:guard |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2221 enddef |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2222 |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2223 " test using an auto-loaded function and variable |
27108
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2224 def Test_vim9_autoload_full_name() |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2225 var lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2226 vim9script |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2227 export def Gettest(): string |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2228 return 'test' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2229 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2230 g:some#name = 'name' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2231 g:some#dict = {key: 'value'} |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2232 |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2233 export def Varargs(a1: string, ...l: list<string>): string |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2234 return a1 .. l[0] .. l[1] |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2235 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2236 END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2237 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2238 mkdir('Xfulldir/autoload', 'p') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2239 writefile(lines, 'Xfulldir/autoload/some.vim') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2240 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2241 exe 'set rtp^=' .. getcwd() .. '/Xfulldir' |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2242 |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2243 assert_equal('test', g:some#Gettest()) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2244 assert_equal('name', g:some#name) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2245 assert_equal('value', g:some#dict.key) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2246 g:some#other = 'other' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2247 assert_equal('other', g:some#other) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2248 |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2249 assert_equal('abc', some#Varargs('a', 'b', 'c')) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2250 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2251 # upper case script name works |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2252 lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2253 vim9script |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2254 export def GetOther(): string |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2255 return 'other' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2256 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2257 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2258 writefile(lines, 'Xfulldir/autoload/Other.vim') |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2259 assert_equal('other', g:Other#GetOther()) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2260 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2261 delete('Xfulldir', 'rf') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2262 &rtp = save_rtp |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2263 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2264 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2265 def Test_vim9script_autoload() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2266 mkdir('Xaldir/autoload', 'p') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2267 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2268 exe 'set rtp^=' .. getcwd() .. '/Xaldir' |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2269 |
27215
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2270 # when the path has "/autoload/" prefix is not needed |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2271 var lines =<< trim END |
27215
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2272 vim9script |
27074
19fefc42a063
patch 8.2.4066: Vim9: imported autoload script loaded again
Bram Moolenaar <Bram@vim.org>
parents:
27068
diff
changeset
|
2273 g:prefixed_loaded += 1 |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2274 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2275 export def Gettest(): string |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2276 return 'test' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2277 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2278 |
27108
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2279 export var name = 'name' |
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2280 |
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2281 export func GetFunc() |
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2282 return Gettest() .. 'more' .. s:name |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2283 endfunc |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2284 |
27108
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2285 export def GetDef(): string |
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2286 return Gettest() .. 'more' .. name |
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2287 enddef |
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2288 |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2289 export final fname = 'final' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2290 export const cname = 'const' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2291 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2292 writefile(lines, 'Xaldir/autoload/prefixed.vim') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2293 |
27074
19fefc42a063
patch 8.2.4066: Vim9: imported autoload script loaded again
Bram Moolenaar <Bram@vim.org>
parents:
27068
diff
changeset
|
2294 g:prefixed_loaded = 0 |
19fefc42a063
patch 8.2.4066: Vim9: imported autoload script loaded again
Bram Moolenaar <Bram@vim.org>
parents:
27068
diff
changeset
|
2295 g:expected_loaded = 0 |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2296 lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2297 vim9script |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2298 import autoload 'prefixed.vim' |
27074
19fefc42a063
patch 8.2.4066: Vim9: imported autoload script loaded again
Bram Moolenaar <Bram@vim.org>
parents:
27068
diff
changeset
|
2299 assert_equal(g:expected_loaded, g:prefixed_loaded) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2300 assert_equal('test', prefixed.Gettest()) |
27074
19fefc42a063
patch 8.2.4066: Vim9: imported autoload script loaded again
Bram Moolenaar <Bram@vim.org>
parents:
27068
diff
changeset
|
2301 assert_equal(1, g:prefixed_loaded) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2302 |
27108
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2303 assert_equal('testmorename', prefixed.GetFunc()) |
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2304 assert_equal('testmorename', prefixed.GetDef()) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2305 assert_equal('name', prefixed.name) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2306 assert_equal('final', prefixed.fname) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2307 assert_equal('const', prefixed.cname) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2308 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2309 v9.CheckScriptSuccess(lines) |
27074
19fefc42a063
patch 8.2.4066: Vim9: imported autoload script loaded again
Bram Moolenaar <Bram@vim.org>
parents:
27068
diff
changeset
|
2310 # can source it again, autoload script not loaded again |
19fefc42a063
patch 8.2.4066: Vim9: imported autoload script loaded again
Bram Moolenaar <Bram@vim.org>
parents:
27068
diff
changeset
|
2311 g:expected_loaded = 1 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2312 v9.CheckScriptSuccess(lines) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2313 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2314 # can also get the items by autoload name |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2315 lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2316 call assert_equal('test', prefixed#Gettest()) |
27108
92e2e96ff559
patch 8.2.4083: Vim9: no test for "vim9script autoload' using script variable
Bram Moolenaar <Bram@vim.org>
parents:
27106
diff
changeset
|
2317 call assert_equal('testmorename', prefixed#GetFunc()) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2318 call assert_equal('name', prefixed#name) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2319 call assert_equal('final', prefixed#fname) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2320 call assert_equal('const', prefixed#cname) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2321 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2322 v9.CheckScriptSuccess(lines) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2323 |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2324 unlet g:prefixed_loaded |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2325 unlet g:expected_loaded |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2326 delete('Xaldir', 'rf') |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2327 &rtp = save_rtp |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2328 enddef |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2329 |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2330 def Test_import_autoload_not_exported() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2331 mkdir('Xnimdir/autoload', 'p') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2332 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2333 exe 'set rtp^=' .. getcwd() .. '/Xnimdir' |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2334 |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2335 # error when using an item that is not exported from an autoload script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2336 var exportLines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2337 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2338 var notExported = 123 |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2339 def NotExport() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2340 echo 'nop' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2341 enddef |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2342 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2343 writefile(exportLines, 'Xnimdir/autoload/notExport1.vim') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2344 |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2345 var lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2346 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2347 import autoload 'notExport1.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2348 echo notExport1.notFound |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2349 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2350 v9.CheckScriptFailure(lines, 'E1048: Item not found in script: notFound') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2351 |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2352 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2353 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2354 import autoload 'notExport1.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2355 echo notExport1.notExported |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2356 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2357 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notExported') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2358 |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2359 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2360 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2361 import autoload 'notExport1.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2362 echo notExport1.NotFunc() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2363 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2364 v9.CheckScriptFailure(lines, 'E1048: Item not found in script: NotFunc') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2365 |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2366 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2367 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2368 import autoload 'notExport1.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2369 echo notExport1.NotExport() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2370 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2371 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: NotExport') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2372 |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2373 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2374 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2375 import autoload 'notExport1.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2376 echo 'text'->notExport1.NotFunc() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2377 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2378 v9.CheckScriptFailure(lines, 'E1048: Item not found in script: NotFunc') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2379 |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2380 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2381 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2382 import autoload 'notExport1.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2383 echo 'text'->notExport1.NotExport() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2384 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2385 v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: NotExport') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2386 |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2387 # using a :def function we use a different autoload script every time so that |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2388 # the function is compiled without the script loaded |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2389 writefile(exportLines, 'Xnimdir/autoload/notExport2.vim') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2390 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2391 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2392 import autoload 'notExport2.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2393 def Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2394 echo notExport2.notFound |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2395 enddef |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2396 Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2397 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2398 v9.CheckScriptFailure(lines, 'E1048: Item not found in script: notExport2#notFound') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2399 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2400 writefile(exportLines, 'Xnimdir/autoload/notExport3.vim') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2401 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2402 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2403 import autoload 'notExport3.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2404 def Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2405 echo notExport3.notExported |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2406 enddef |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2407 Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2408 END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2409 # don't get E1049 because it is too complicated to figure out |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2410 v9.CheckScriptFailure(lines, 'E1048: Item not found in script: notExport3#notExported') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2411 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2412 writefile(exportLines, 'Xnimdir/autoload/notExport4.vim') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2413 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2414 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2415 import autoload 'notExport4.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2416 def Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2417 echo notExport4.NotFunc() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2418 enddef |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2419 Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2420 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2421 v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport4#NotFunc') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2422 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2423 writefile(exportLines, 'Xnimdir/autoload/notExport5.vim') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2424 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2425 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2426 import autoload 'notExport5.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2427 def Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2428 echo notExport5.NotExport() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2429 enddef |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2430 Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2431 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2432 v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport5#NotExport') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2433 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2434 writefile(exportLines, 'Xnimdir/autoload/notExport6.vim') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2435 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2436 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2437 import autoload 'notExport6.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2438 def Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2439 echo 'text'->notExport6.NotFunc() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2440 enddef |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2441 Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2442 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2443 v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport6#NotFunc') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2444 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2445 writefile(exportLines, 'Xnimdir/autoload/notExport7.vim') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2446 lines =<< trim END |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2447 vim9script |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2448 import autoload 'notExport7.vim' |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2449 def Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2450 echo 'text'->notExport7.NotExport() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2451 enddef |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2452 Testit() |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2453 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2454 v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport7#NotExport') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2455 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2456 delete('Xnimdir', 'rf') |
27217
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2457 &rtp = save_rtp |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2458 enddef |
facb54d20a50
patch 8.2.4137: Vim9: calling import with and without method is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27215
diff
changeset
|
2459 |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2460 def Test_vim9script_autoload_call() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2461 mkdir('Xcalldir/autoload', 'p') |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2462 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2463 exe 'set rtp^=' .. getcwd() .. '/Xcalldir' |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2464 |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2465 var lines =<< trim END |
27215
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2466 vim9script |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2467 |
27205
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2468 export def RetArg(arg: string): string |
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2469 return arg |
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2470 enddef |
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2471 |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2472 export def Getother() |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2473 g:result = 'other' |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2474 enddef |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2475 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2476 writefile(lines, 'Xcalldir/autoload/another.vim') |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2477 |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2478 lines =<< trim END |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2479 vim9script |
27080
9897dd3c6530
patch 8.2.4069: Vim9: import test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
27076
diff
changeset
|
2480 import autoload 'another.vim' |
27205
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2481 |
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2482 # compile this before 'another.vim' is loaded |
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2483 def CallAnother() |
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2484 assert_equal('foo', 'foo'->another.RetArg()) |
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2485 enddef |
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2486 CallAnother() |
6c177a9b436e
patch 8.2.4131: Vim9: calling function in autoload import does not work
Bram Moolenaar <Bram@vim.org>
parents:
27189
diff
changeset
|
2487 |
27080
9897dd3c6530
patch 8.2.4069: Vim9: import test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
27076
diff
changeset
|
2488 call another.Getother() |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2489 assert_equal('other', g:result) |
27295
69aa20a6e7ae
patch 8.2.4176: Vim9: cannot use imported function with call()
Bram Moolenaar <Bram@vim.org>
parents:
27291
diff
changeset
|
2490 |
69aa20a6e7ae
patch 8.2.4176: Vim9: cannot use imported function with call()
Bram Moolenaar <Bram@vim.org>
parents:
27291
diff
changeset
|
2491 assert_equal('arg', call('another.RetArg', ['arg'])) |
27563
a54064e14114
patch 8.2.4308: Vim9: cannot list autoload function
Bram Moolenaar <Bram@vim.org>
parents:
27499
diff
changeset
|
2492 |
a54064e14114
patch 8.2.4308: Vim9: cannot list autoload function
Bram Moolenaar <Bram@vim.org>
parents:
27499
diff
changeset
|
2493 verbose function another.Getother |
a54064e14114
patch 8.2.4308: Vim9: cannot list autoload function
Bram Moolenaar <Bram@vim.org>
parents:
27499
diff
changeset
|
2494 # should we disallow this? |
a54064e14114
patch 8.2.4308: Vim9: cannot list autoload function
Bram Moolenaar <Bram@vim.org>
parents:
27499
diff
changeset
|
2495 verbose function another#Getother |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2496 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2497 v9.CheckScriptSuccess(lines) |
27076
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2498 |
ceff6a546748
patch 8.2.4067: Vim9: cannot call imported function with :call
Bram Moolenaar <Bram@vim.org>
parents:
27074
diff
changeset
|
2499 unlet g:result |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2500 delete('Xcalldir', 'rf') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2501 &rtp = save_rtp |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2502 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2503 |
27297
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2504 def Test_vim9script_noclear_autoload() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2505 mkdir('Xnocdir/autoload', 'p') |
27297
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2506 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2507 exe 'set rtp^=' .. getcwd() .. '/Xnocdir' |
27297
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2508 |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2509 var lines =<< trim END |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2510 vim9script |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2511 export def Func(): string |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2512 return 'called' |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2513 enddef |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2514 g:double_loaded = 'yes' |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2515 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2516 writefile(lines, 'Xnocdir/autoload/double.vim') |
27297
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2517 |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2518 lines =<< trim END |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2519 vim9script noclear |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2520 if exists('g:script_loaded') |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2521 finish |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2522 endif |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2523 g:script_loaded = true |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2524 |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2525 import autoload 'double.vim' |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2526 nnoremap <F3> <ScriptCmd>g:result = double.Func()<CR> |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2527 END |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2528 g:double_loaded = 'no' |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2529 writefile(lines, 'Xloaddouble') |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2530 source Xloaddouble |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2531 assert_equal('no', g:double_loaded) |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2532 assert_equal(true, g:script_loaded) |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2533 source Xloaddouble |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2534 feedkeys("\<F3>", 'xt') |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2535 assert_equal('called', g:result) |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2536 assert_equal('yes', g:double_loaded) |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2537 |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2538 delete('Xloaddouble') |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2539 unlet g:double_loaded |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2540 unlet g:script_loaded |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2541 unlet g:result |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2542 delete('Xnocdir', 'rf') |
27297
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2543 &rtp = save_rtp |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2544 enddef |
f7cb41ff22a4
patch 8.2.4177: Vim9: autoload script not loaded after "vim9script noclear"
Bram Moolenaar <Bram@vim.org>
parents:
27295
diff
changeset
|
2545 |
27267
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2546 def Test_vim9script_autoload_duplicate() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2547 mkdir('Xdupdir/autoload', 'p') |
27267
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2548 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2549 var lines =<< trim END |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2550 vim9script |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2551 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2552 export def Func() |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2553 enddef |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2554 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2555 def Func() |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2556 enddef |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2557 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2558 writefile(lines, 'Xdupdir/autoload/dupfunc.vim') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2559 assert_fails('source Xdupdir/autoload/dupfunc.vim', 'E1073:') |
27267
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2560 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2561 lines =<< trim END |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2562 vim9script |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2563 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2564 def Func() |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2565 enddef |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2566 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2567 export def Func() |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2568 enddef |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2569 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2570 writefile(lines, 'Xdupdir/autoload/dup2func.vim') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2571 assert_fails('source Xdupdir/autoload/dup2func.vim', 'E1073:') |
27267
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2572 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2573 lines =<< trim END |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2574 vim9script |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2575 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2576 def Func() |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2577 enddef |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2578 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2579 export var Func = 'asdf' |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2580 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2581 writefile(lines, 'Xdupdir/autoload/dup3func.vim') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2582 assert_fails('source Xdupdir/autoload/dup3func.vim', 'E1041: Redefining script item: "Func"') |
27267
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2583 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2584 lines =<< trim END |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2585 vim9script |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2586 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2587 export var Func = 'asdf' |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2588 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2589 def Func() |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2590 enddef |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2591 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2592 writefile(lines, 'Xdupdir/autoload/dup4func.vim') |
30819
d50d32026617
patch 9.0.0744: in script in autoload dir exported variable is not found
Bram Moolenaar <Bram@vim.org>
parents:
30705
diff
changeset
|
2593 assert_fails('source Xdupdir/autoload/dup4func.vim', 'E1041:') |
27267
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2594 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2595 lines =<< trim END |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2596 vim9script |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2597 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2598 var Func = 'asdf' |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2599 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2600 export def Func() |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2601 enddef |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2602 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2603 writefile(lines, 'Xdupdir/autoload/dup5func.vim') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2604 assert_fails('source Xdupdir/autoload/dup5func.vim', 'E707:') |
27267
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2605 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2606 lines =<< trim END |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2607 vim9script |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2608 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2609 export def Func() |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2610 enddef |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2611 |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2612 var Func = 'asdf' |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2613 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2614 writefile(lines, 'Xdupdir/autoload/dup6func.vim') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2615 assert_fails('source Xdupdir/autoload/dup6func.vim', 'E1041: Redefining script item: "Func"') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2616 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2617 delete('Xdupdir', 'rf') |
27267
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2618 enddef |
322b79b002b7
patch 8.2.4162: Vim9: no error for redefining function with export
Bram Moolenaar <Bram@vim.org>
parents:
27265
diff
changeset
|
2619 |
27269
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2620 def Test_autoload_missing_function_name() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2621 mkdir('Xmisdir/autoload', 'p') |
27269
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2622 |
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2623 var lines =<< trim END |
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2624 vim9script |
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2625 |
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2626 def loadme#() |
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2627 enddef |
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2628 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2629 writefile(lines, 'Xmisdir/autoload/loadme.vim') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2630 assert_fails('source Xmisdir/autoload/loadme.vim', 'E129:') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2631 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2632 delete('Xmisdir', 'rf') |
27269
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2633 enddef |
24da57a079ef
patch 8.2.4163: no error for omitting function name after autoload prefix
Bram Moolenaar <Bram@vim.org>
parents:
27267
diff
changeset
|
2634 |
27464
a14c4d3e3260
patch 8.2.4260: Vim9: can still use a global function without g:
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
2635 def Test_autoload_name_wrong() |
27291
0f0fa4d12303
patch 8.2.4174: Vim9: can use an autoload name in normal script
Bram Moolenaar <Bram@vim.org>
parents:
27289
diff
changeset
|
2636 var lines =<< trim END |
0f0fa4d12303
patch 8.2.4174: Vim9: can use an autoload name in normal script
Bram Moolenaar <Bram@vim.org>
parents:
27289
diff
changeset
|
2637 def Xscriptname#Func() |
0f0fa4d12303
patch 8.2.4174: Vim9: can use an autoload name in normal script
Bram Moolenaar <Bram@vim.org>
parents:
27289
diff
changeset
|
2638 enddef |
0f0fa4d12303
patch 8.2.4174: Vim9: can use an autoload name in normal script
Bram Moolenaar <Bram@vim.org>
parents:
27289
diff
changeset
|
2639 END |
0f0fa4d12303
patch 8.2.4174: Vim9: can use an autoload name in normal script
Bram Moolenaar <Bram@vim.org>
parents:
27289
diff
changeset
|
2640 writefile(lines, 'Xscriptname.vim') |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2641 v9.CheckScriptFailure(lines, 'E746:') |
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2642 delete('Xscriptname.vim') |
27291
0f0fa4d12303
patch 8.2.4174: Vim9: can use an autoload name in normal script
Bram Moolenaar <Bram@vim.org>
parents:
27289
diff
changeset
|
2643 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2644 mkdir('Xwrodir/autoload', 'p') |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2645 lines =<< trim END |
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2646 vim9script |
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2647 def somescript#Func() |
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2648 enddef |
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2649 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2650 writefile(lines, 'Xwrodir/autoload/somescript.vim') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2651 assert_fails('source Xwrodir/autoload/somescript.vim', 'E1263:') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2652 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2653 delete('Xwrodir', 'rf') |
27291
0f0fa4d12303
patch 8.2.4174: Vim9: can use an autoload name in normal script
Bram Moolenaar <Bram@vim.org>
parents:
27289
diff
changeset
|
2654 enddef |
0f0fa4d12303
patch 8.2.4174: Vim9: can use an autoload name in normal script
Bram Moolenaar <Bram@vim.org>
parents:
27289
diff
changeset
|
2655 |
27086
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2656 def Test_import_autoload_postponed() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2657 mkdir('Xpostdir/autoload', 'p') |
27086
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2658 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2659 exe 'set rtp^=' .. getcwd() .. '/Xpostdir' |
27086
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2660 |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2661 var lines =<< trim END |
27215
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2662 vim9script |
27086
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2663 |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2664 g:loaded_postponed = 'true' |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2665 export var variable = 'bla' |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2666 export def Function(): string |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2667 return 'bla' |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2668 enddef |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2669 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2670 writefile(lines, 'Xpostdir/autoload/postponed.vim') |
27086
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2671 |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2672 lines =<< trim END |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2673 vim9script |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2674 |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2675 import autoload 'postponed.vim' |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2676 def Tryit() |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2677 echo postponed.variable |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2678 echo postponed.Function() |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2679 enddef |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2680 defcompile |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2681 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2682 v9.CheckScriptSuccess(lines) |
27086
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2683 assert_false(exists('g:loaded_postponed')) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2684 v9.CheckScriptSuccess(lines + ['Tryit()']) |
27086
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2685 assert_equal('true', g:loaded_postponed) |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2686 |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2687 unlet g:loaded_postponed |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2688 delete('Xpostdir', 'rf') |
27086
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2689 &rtp = save_rtp |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2690 enddef |
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27080
diff
changeset
|
2691 |
27116
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2692 def Test_import_autoload_override() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2693 mkdir('Xoverdir/autoload', 'p') |
27116
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2694 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2695 exe 'set rtp^=' .. getcwd() .. '/Xoverdir' |
27116
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2696 test_override('autoload', 1) |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2697 |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2698 var lines =<< trim END |
27215
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2699 vim9script |
27116
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2700 |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2701 g:loaded_override = 'true' |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2702 export var variable = 'bla' |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2703 export def Function(): string |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2704 return 'bla' |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2705 enddef |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2706 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2707 writefile(lines, 'Xoverdir/autoload/override.vim') |
27116
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2708 |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2709 lines =<< trim END |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2710 vim9script |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2711 |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2712 import autoload 'override.vim' |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2713 assert_equal('true', g:loaded_override) |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2714 |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2715 def Tryit() |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2716 echo override.doesNotExist |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2717 enddef |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2718 defcompile |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2719 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2720 v9.CheckScriptFailure(lines, 'E1048: Item not found in script: doesNotExist', 1) |
27116
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2721 |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2722 test_override('autoload', 0) |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2723 unlet g:loaded_override |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2724 delete('Xoverdir', 'rf') |
27116
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2725 &rtp = save_rtp |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2726 enddef |
5b267700e6ab
patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents:
27112
diff
changeset
|
2727 |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2728 def Test_autoload_mapping() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2729 mkdir('Xmapdir/autoload', 'p') |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2730 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2731 exe 'set rtp^=' .. getcwd() .. '/Xmapdir' |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2732 |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2733 var lines =<< trim END |
27215
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2734 vim9script |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2735 |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2736 g:toggle_loaded = 'yes' |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2737 |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2738 export def Toggle(): string |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2739 return ":g:toggle_called = 'yes'\<CR>" |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2740 enddef |
27140
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2741 export def Doit() |
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2742 g:doit_called = 'yes' |
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2743 enddef |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2744 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2745 writefile(lines, 'Xmapdir/autoload/toggle.vim') |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2746 |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2747 lines =<< trim END |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2748 vim9script |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2749 |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2750 import autoload 'toggle.vim' |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2751 |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2752 nnoremap <silent> <expr> tt toggle.Toggle() |
27140
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2753 nnoremap <silent> xx <ScriptCmd>toggle.Doit()<CR> |
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2754 nnoremap <silent> yy <Cmd>toggle.Doit()<CR> |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2755 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2756 v9.CheckScriptSuccess(lines) |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2757 assert_false(exists("g:toggle_loaded")) |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2758 assert_false(exists("g:toggle_called")) |
27213
42561e956a70
patch 8.2.4135: Vim9: ":scriptnames" shows unloaded imported autoload script
Bram Moolenaar <Bram@vim.org>
parents:
27207
diff
changeset
|
2759 assert_match('\d A: \f*[/\\]toggle.vim', execute('scriptnames')) |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2760 |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2761 feedkeys("tt", 'xt') |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2762 assert_equal('yes', g:toggle_loaded) |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2763 assert_equal('yes', g:toggle_called) |
27213
42561e956a70
patch 8.2.4135: Vim9: ":scriptnames" shows unloaded imported autoload script
Bram Moolenaar <Bram@vim.org>
parents:
27207
diff
changeset
|
2764 assert_match('\d: \f*[/\\]toggle.vim', execute('scriptnames')) |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2765 |
27140
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2766 feedkeys("xx", 'xt') |
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2767 assert_equal('yes', g:doit_called) |
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2768 |
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2769 assert_fails('call feedkeys("yy", "xt")', 'E121: Undefined variable: toggle') |
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2770 |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2771 nunmap tt |
27140
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2772 nunmap xx |
a9eeb18e749c
patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Bram Moolenaar <Bram@vim.org>
parents:
27116
diff
changeset
|
2773 nunmap yy |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2774 unlet g:toggle_loaded |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2775 unlet g:toggle_called |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2776 delete('Xmapdir', 'rf') |
27061
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2777 &rtp = save_rtp |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2778 enddef |
1a56c0252772
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Bram Moolenaar <Bram@vim.org>
parents:
27059
diff
changeset
|
2779 |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2780 def Test_vim9script_autoload_fails() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2781 var lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2782 vim9script autoload |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2783 var n = 0 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2784 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2785 v9.CheckScriptFailure(lines, 'E475: Invalid argument: autoload') |
27215
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2786 |
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2787 lines =<< trim END |
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2788 vim9script noclear noclear |
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2789 var n = 0 |
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2790 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2791 v9.CheckScriptFailure(lines, 'E983: Duplicate argument: noclear') |
28570
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
2792 |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
2793 lines =<< trim END |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
2794 vim9script noclears |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
2795 var n = 0 |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
2796 END |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28461
diff
changeset
|
2797 v9.CheckScriptFailure(lines, 'E475: Invalid argument: noclears') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2798 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2799 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2800 def Test_import_autoload_fails() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2801 var lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2802 vim9script |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2803 import autoload autoload 'prefixed.vim' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2804 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2805 v9.CheckScriptFailure(lines, 'E121: Undefined variable: autoload') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2806 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2807 lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2808 vim9script |
27207
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2809 import autoload './doesNotExist.vim' |
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2810 END |
28255
48b9ffd40f38
patch 8.2.4653: "import autoload" does not check the file name
Bram Moolenaar <Bram@vim.org>
parents:
28249
diff
changeset
|
2811 v9.CheckScriptFailure(lines, 'E282:', 2) |
27207
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2812 |
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2813 lines =<< trim END |
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2814 vim9script |
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2815 import autoload '/dir/doesNotExist.vim' |
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2816 END |
28255
48b9ffd40f38
patch 8.2.4653: "import autoload" does not check the file name
Bram Moolenaar <Bram@vim.org>
parents:
28249
diff
changeset
|
2817 v9.CheckScriptFailure(lines, 'E282:', 2) |
48b9ffd40f38
patch 8.2.4653: "import autoload" does not check the file name
Bram Moolenaar <Bram@vim.org>
parents:
28249
diff
changeset
|
2818 |
48b9ffd40f38
patch 8.2.4653: "import autoload" does not check the file name
Bram Moolenaar <Bram@vim.org>
parents:
28249
diff
changeset
|
2819 lines =<< trim END |
48b9ffd40f38
patch 8.2.4653: "import autoload" does not check the file name
Bram Moolenaar <Bram@vim.org>
parents:
28249
diff
changeset
|
2820 vim9script |
48b9ffd40f38
patch 8.2.4653: "import autoload" does not check the file name
Bram Moolenaar <Bram@vim.org>
parents:
28249
diff
changeset
|
2821 import autoload '../testdir' |
48b9ffd40f38
patch 8.2.4653: "import autoload" does not check the file name
Bram Moolenaar <Bram@vim.org>
parents:
28249
diff
changeset
|
2822 END |
48b9ffd40f38
patch 8.2.4653: "import autoload" does not check the file name
Bram Moolenaar <Bram@vim.org>
parents:
28249
diff
changeset
|
2823 v9.CheckScriptFailure(lines, 'E17:', 2) |
27207
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2824 |
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2825 lines =<< trim END |
7b8e2bea0ec5
patch 8.2.4132: Vim9: wrong error message when autoload script can't be found
Bram Moolenaar <Bram@vim.org>
parents:
27205
diff
changeset
|
2826 vim9script |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2827 import autoload 'doesNotExist.vim' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2828 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2829 v9.CheckScriptFailure(lines, 'E1053: Could not import "doesNotExist.vim"') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2830 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2831 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2832 " test disassembling an auto-loaded function starting with "debug" |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2833 def Test_vim9_autoload_disass() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2834 mkdir('Xdasdir/autoload', 'p') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2835 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2836 exe 'set rtp^=' .. getcwd() .. '/Xdasdir' |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2837 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2838 var lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2839 vim9script |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2840 export def Test(): string |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2841 return 'debug' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2842 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2843 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2844 writefile(lines, 'Xdasdir/autoload/debugit.vim') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2845 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2846 lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2847 vim9script |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2848 export def Test(): string |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2849 return 'profile' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2850 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2851 END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2852 writefile(lines, 'Xdasdir/autoload/profileit.vim') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2853 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2854 lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2855 vim9script |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2856 assert_equal('debug', debugit#Test()) |
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2857 disass debugit#Test |
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2858 assert_equal('profile', profileit#Test()) |
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2859 disass profileit#Test |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2860 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2861 v9.CheckScriptSuccess(lines) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2862 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2863 delete('Xdasdir', 'rf') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2864 &rtp = save_rtp |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2865 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2866 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2867 " test using a vim9script that is auto-loaded from an autocmd |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2868 def Test_vim9_aucmd_autoload() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2869 var lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2870 vim9script |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2871 export def Test() |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2872 echomsg getreg('"') |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2873 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2874 END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2875 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2876 mkdir('Xauldir/autoload', 'p') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2877 writefile(lines, 'Xauldir/autoload/foo.vim') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2878 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2879 exe 'set rtp^=' .. getcwd() .. '/Xauldir' |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2880 augroup test |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
2881 autocmd TextYankPost * call foo#Test() |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2882 augroup END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2883 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2884 normal Y |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2885 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2886 augroup test |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2887 autocmd! |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2888 augroup END |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2889 delete('Xauldir', 'rf') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2890 &rtp = save_rtp |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2891 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2892 |
27106
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2893 " test using a autoloaded file that is case sensitive |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2894 def Test_vim9_autoload_case_sensitive() |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2895 var lines =<< trim END |
27215
5b54f413d132
patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful
Bram Moolenaar <Bram@vim.org>
parents:
27213
diff
changeset
|
2896 vim9script |
27106
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2897 export def CaseSensitive(): string |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2898 return 'done' |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2899 enddef |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2900 END |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2901 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2902 mkdir('Xcasedir/autoload', 'p') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2903 writefile(lines, 'Xcasedir/autoload/CaseSensitive.vim') |
27106
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2904 var save_rtp = &rtp |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2905 exe 'set rtp^=' .. getcwd() .. '/Xcasedir' |
27106
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2906 |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2907 lines =<< trim END |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2908 vim9script |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2909 import autoload 'CaseSensitive.vim' |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2910 assert_equal('done', CaseSensitive.CaseSensitive()) |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2911 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2912 v9.CheckScriptSuccess(lines) |
27106
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2913 |
27150
2d0ea3f9ffe1
patch 8.2.4104: Vim9: lower casing the autoload prefix causes problems
Bram Moolenaar <Bram@vim.org>
parents:
27146
diff
changeset
|
2914 if !has('fname_case') |
2d0ea3f9ffe1
patch 8.2.4104: Vim9: lower casing the autoload prefix causes problems
Bram Moolenaar <Bram@vim.org>
parents:
27146
diff
changeset
|
2915 lines =<< trim END |
2d0ea3f9ffe1
patch 8.2.4104: Vim9: lower casing the autoload prefix causes problems
Bram Moolenaar <Bram@vim.org>
parents:
27146
diff
changeset
|
2916 vim9script |
2d0ea3f9ffe1
patch 8.2.4104: Vim9: lower casing the autoload prefix causes problems
Bram Moolenaar <Bram@vim.org>
parents:
27146
diff
changeset
|
2917 import autoload 'CaseSensitive.vim' |
2d0ea3f9ffe1
patch 8.2.4104: Vim9: lower casing the autoload prefix causes problems
Bram Moolenaar <Bram@vim.org>
parents:
27146
diff
changeset
|
2918 import autoload 'casesensitive.vim' |
2d0ea3f9ffe1
patch 8.2.4104: Vim9: lower casing the autoload prefix causes problems
Bram Moolenaar <Bram@vim.org>
parents:
27146
diff
changeset
|
2919 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2920 v9.CheckScriptFailure(lines, 'E1262:') |
27150
2d0ea3f9ffe1
patch 8.2.4104: Vim9: lower casing the autoload prefix causes problems
Bram Moolenaar <Bram@vim.org>
parents:
27146
diff
changeset
|
2921 endif |
2d0ea3f9ffe1
patch 8.2.4104: Vim9: lower casing the autoload prefix causes problems
Bram Moolenaar <Bram@vim.org>
parents:
27146
diff
changeset
|
2922 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29930
diff
changeset
|
2923 delete('Xcasedir', 'rf') |
27106
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2924 &rtp = save_rtp |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2925 enddef |
d7e6b85dd89d
patch 8.2.4082: check for autoload file name and prefix fails
Bram Moolenaar <Bram@vim.org>
parents:
27086
diff
changeset
|
2926 |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2927 " This was causing a crash because suppress_errthrow wasn't reset. |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2928 def Test_vim9_autoload_error() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2929 var lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2930 vim9script |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2931 def crash#func() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2932 try |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2933 for x in List() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2934 endfor |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2935 catch |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2936 endtry |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2937 g:ok = true |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2938 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2939 fu List() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2940 invalid |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2941 endfu |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2942 try |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2943 alsoinvalid |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2944 catch /wontmatch/ |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2945 endtry |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2946 END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2947 call mkdir('Xruntime/autoload', 'p') |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2948 call writefile(lines, 'Xruntime/autoload/crash.vim') |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2949 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2950 # run in a separate Vim to avoid the side effects of assert_fails() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2951 lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2952 exe 'set rtp^=' .. getcwd() .. '/Xruntime' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2953 call crash#func() |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2954 call writefile(['ok'], 'Xdidit') |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2955 qall! |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2956 END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2957 writefile(lines, 'Xscript') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2958 g:RunVim([], [], '-S Xscript') |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2959 assert_equal(['ok'], readfile('Xdidit')) |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2960 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2961 delete('Xdidit') |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2962 delete('Xscript') |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2963 delete('Xruntime', 'rf') |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2964 |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2965 lines =<< trim END |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2966 vim9script |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2967 var foo#bar = 'asdf' |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2968 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
2969 v9.CheckScriptFailure(lines, 'E461: Illegal variable name: foo#bar', 2) |
27057
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2970 enddef |
8f6cab688901
patch 8.2.4057: Vim9: not fully implementing the autoload mechanism
Bram Moolenaar <Bram@vim.org>
parents:
27030
diff
changeset
|
2971 |
29828
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2972 def Test_vim9_import_symlink() |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2973 if !has('unix') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2974 CheckUnix |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2975 else |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2976 mkdir('Xto/plugin', 'p') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2977 var lines =<< trim END |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2978 vim9script |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2979 import autoload 'bar.vim' |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2980 g:resultFunc = bar.Func() |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2981 g:resultValue = bar.value |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2982 END |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2983 writefile(lines, 'Xto/plugin/foo.vim') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2984 |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2985 mkdir('Xto/autoload', 'p') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2986 lines =<< trim END |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2987 vim9script |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2988 export def Func(): string |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2989 return 'func' |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2990 enddef |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2991 export var value = 'val' |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2992 END |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2993 writefile(lines, 'Xto/autoload/bar.vim') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2994 |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2995 var save_rtp = &rtp |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2996 &rtp = getcwd() .. '/Xfrom' |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2997 system('ln -s ' .. getcwd() .. '/Xto Xfrom') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2998 |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
2999 source Xfrom/plugin/foo.vim |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3000 assert_equal('func', g:resultFunc) |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3001 assert_equal('val', g:resultValue) |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3002 |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3003 var infoTo = getscriptinfo()->filter((_, v) => v.name =~ 'Xto/autoload/bar') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3004 var infoFrom = getscriptinfo()->filter((_, v) => v.name =~ 'Xfrom/autoload/bar') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3005 assert_equal(1, len(infoTo)) |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3006 assert_equal(1, len(infoFrom)) |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3007 assert_equal(infoTo[0].sid, infoFrom[0].sourced) |
29836
a8831ab29aee
patch 9.0.0257: "->" in ":scriptnames" output not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
29828
diff
changeset
|
3008 var output: string |
a8831ab29aee
patch 9.0.0257: "->" in ":scriptnames" output not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
29828
diff
changeset
|
3009 redir => output |
a8831ab29aee
patch 9.0.0257: "->" in ":scriptnames" output not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
29828
diff
changeset
|
3010 scriptnames |
a8831ab29aee
patch 9.0.0257: "->" in ":scriptnames" output not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
29828
diff
changeset
|
3011 redir END |
a8831ab29aee
patch 9.0.0257: "->" in ":scriptnames" output not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
29828
diff
changeset
|
3012 assert_match(infoFrom[0].sid .. '->' .. infoFrom[0].sourced .. '.*Xfrom', output) |
29828
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3013 |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3014 unlet g:resultFunc |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3015 unlet g:resultValue |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3016 &rtp = save_rtp |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3017 delete('Xto', 'rf') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3018 delete('Xfrom', 'rf') |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3019 endif |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3020 enddef |
6b7020f3d856
patch 9.0.0253: a symlink to an autoload script results in two entries
Bram Moolenaar <Bram@vim.org>
parents:
29810
diff
changeset
|
3021 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3022 |
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3023 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |