Mercurial > vim
comparison src/testdir/test_execute_func.vim @ 27457:4c16acb2525f v8.2.4257
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Commit: https://github.com/vim/vim/commit/62aec93bfdb9e1b40d03a6d2e8e9511f8b1bdb2d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 29 21:45:34 2022 +0000
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Problem: Vim9: finding global function without g: prefix but not finding
global variable is inconsistent.
Solution: Require using g: for a global function. Change the vim9.vim
script into a Vim9 script with exports. Fix that import in legacy
script does not work.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 29 Jan 2022 23:00:05 +0100 |
parents | 8d9506f3542e |
children | 029c59bf78f1 |
comparison
equal
deleted
inserted
replaced
27456:a8e2d91995ce | 27457:4c16acb2525f |
---|---|
1 " test execute() | 1 " test execute() |
2 | 2 |
3 source view_util.vim | 3 source view_util.vim |
4 source check.vim | 4 source check.vim |
5 source vim9.vim | 5 import './vim9.vim' as v9 |
6 source term_util.vim | 6 source term_util.vim |
7 | 7 |
8 func NestedEval() | 8 func NestedEval() |
9 let nested = execute('echo "nested\nlines"') | 9 let nested = execute('echo "nested\nlines"') |
10 echo 'got: "' . nested . '"' | 10 echo 'got: "' . nested . '"' |
39 call assert_equal("\nsomething", execute('echo "something"', 'silent!')) | 39 call assert_equal("\nsomething", execute('echo "something"', 'silent!')) |
40 call assert_equal("", execute('burp', 'silent!')) | 40 call assert_equal("", execute('burp', 'silent!')) |
41 if has('float') | 41 if has('float') |
42 call assert_fails('call execute(3.4)', 'E492:') | 42 call assert_fails('call execute(3.4)', 'E492:') |
43 call assert_equal("\nx", execute("echo \"x\"", 3.4)) | 43 call assert_equal("\nx", execute("echo \"x\"", 3.4)) |
44 call CheckDefExecAndScriptFailure(['execute("echo \"x\"", 3.4)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1174:']) | 44 call v9.CheckDefExecAndScriptFailure(['execute("echo \"x\"", 3.4)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1174:']) |
45 endif | 45 endif |
46 endfunc | 46 endfunc |
47 | 47 |
48 func Test_execute_list() | 48 func Test_execute_list() |
49 call assert_equal("\nsomething\nnice", execute(['echo "something"', 'echo "nice"'])) | 49 call assert_equal("\nsomething\nnice", execute(['echo "something"', 'echo "nice"'])) |