diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 07:39:57 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 07:40:16 +0000 |
commit | 6af24b2457752c0d36aaf9f29f03d39afd09937f (patch) | |
tree | 2671b594908d1f971de6b2a2d473f97dfb7291d2 /src/testdir/test_vim9_import.vim | |
parent | Releasing progress-linux version 2:9.1.0016-1~progress7.99u1. (diff) | |
download | vim-6af24b2457752c0d36aaf9f29f03d39afd09937f.tar.xz vim-6af24b2457752c0d36aaf9f29f03d39afd09937f.zip |
Merging upstream version 2:9.1.0199.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/testdir/test_vim9_import.vim')
-rw-r--r-- | src/testdir/test_vim9_import.vim | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim index d470a34..fa1aeb1 100644 --- a/src/testdir/test_vim9_import.vim +++ b/src/testdir/test_vim9_import.vim @@ -2929,5 +2929,54 @@ def Test_export_in_conditional_block() v9.CheckScriptSuccess(lines) enddef +" Import fails when an autoloaded script is imported again. +" Github issue #14171 +def Test_import_autloaded_script() + mkdir('Ximporttwice', 'pR') + mkdir('Ximporttwice/plugin') + mkdir('Ximporttwice/autoload') + var save_rtp = &rtp + exe 'set rtp^=' .. getcwd() .. '/Ximporttwice' + + var lines =<< trim END + vim9script + + export def H(): number + return 10 + enddef + END + writefile(lines, 'Ximporttwice/autoload/hello.vim') + + lines =<< trim END + vim9script + + import "./hello.vim" + export def W(): number + return 20 + enddef + END + writefile(lines, 'Ximporttwice/autoload/world.vim') + + lines =<< trim END + vim9script + + import autoload '../autoload/hello.vim' + import autoload '../autoload/world.vim' + + command Hello echo hello.H() + command World echo world.W() + END + writefile(lines, 'Ximporttwice/plugin/main.vim') + + lines =<< trim END + vim9script + + source ./Ximporttwice/plugin/main.vim + assert_equal(['20'], execute('World')->split("\n")) + END + v9.CheckScriptSuccess(lines) + + &rtp = save_rtp +enddef " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |