Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 27043:15f40772e10a v8.2.4050
patch 8.2.4050: Vim9: need to prefix every item in an autoload script
Commit: https://github.com/vim/vim/commit/dc4451df61a6aa12a0661817b7094fb32f09e11d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 9 21:36:37 2022 +0000
patch 8.2.4050: Vim9: need to prefix every item in an autoload script
Problem: Vim9: need to prefix every item in an autoload script.
Solution: First step in supporting "vim9script autoload" and "import
autoload".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 09 Jan 2022 22:45:04 +0100 |
parents | b861ae62860d |
children | 140102677c12 |
comparison
equal
deleted
inserted
replaced
27042:8fc14d120630 | 27043:15f40772e10a |
---|---|
3030 enddef | 3030 enddef |
3031 END | 3031 END |
3032 writefile(lines, 'Xdir/autoload/Other.vim') | 3032 writefile(lines, 'Xdir/autoload/Other.vim') |
3033 assert_equal('other', g:Other#getOther()) | 3033 assert_equal('other', g:Other#getOther()) |
3034 | 3034 |
3035 # using "vim9script autoload" prefix is not needed | |
3036 lines =<< trim END | |
3037 vim9script autoload | |
3038 g:prefixed_loaded = 'yes' | |
3039 export def Gettest(): string | |
3040 return 'test' | |
3041 enddef | |
3042 export var name = 'name' | |
3043 END | |
3044 writefile(lines, 'Xdir/autoload/prefixed.vim') | |
3045 | |
3046 lines =<< trim END | |
3047 vim9script | |
3048 import autoload 'prefixed.vim' | |
3049 assert_false(exists('g:prefixed_loaded')) | |
3050 assert_equal('test', prefixed.Gettest()) | |
3051 assert_equal('yes', g:prefixed_loaded) | |
3052 END | |
3053 CheckScriptSuccess(lines) | |
3054 | |
3035 delete('Xdir', 'rf') | 3055 delete('Xdir', 'rf') |
3036 &rtp = save_rtp | 3056 &rtp = save_rtp |
3037 enddef | 3057 enddef |
3038 | 3058 |
3039 " test disassembling an auto-loaded function starting with "debug" | 3059 " test disassembling an auto-loaded function starting with "debug" |