changeset 34981:76e3b9d514a8 v9.1.0346

patch 9.1.0346: Patch v9.1.0338 fixed sourcing a script with import Commit: https://github.com/vim/vim/commit/1433ac93eb3acf28c55f0c4d775716ebee543160 Author: Ernie Rael <errael@raelity.com> Date: Wed Apr 17 22:36:32 2024 +0200 patch 9.1.0346: Patch v9.1.0338 fixed sourcing a script with import Problem: Patch v9.1.0338 fixed sourcing a script with import Solution: Add test `import './file.vim' and verify it works with `:source` so it does not regress (Ernie Rael) closes: #14577 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Wed, 17 Apr 2024 22:45:03 +0200
parents 7129cffaa3bc
children 3d41e3760130
files src/testdir/test_vim9_import.vim src/version.c
diffstat 2 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_import.vim
+++ b/src/testdir/test_vim9_import.vim
@@ -1140,6 +1140,31 @@ def Test_autoload_import_relative()
   v9.CheckScriptFailure(lines, 'E484:')
 enddef
 
+def Test_autoload_import_relative_compiled()
+  # autoload relative, access from compiled function. #14565
+  var lines =<< trim END
+    vim9script
+
+    export def F1(): string
+        return 'InFile.vim'
+    enddef
+  END
+  writefile(lines, 'xfile.vim', 'D')
+  lines =<< trim END
+    vim9script
+
+    import autoload './xfile.vim'
+
+    def F(): string
+      return xfile.F1()
+    enddef
+    assert_equal('InFile.vim', F())
+  END
+  new
+  setline(1, lines)
+  :source
+enddef
+
 def Test_autoload_import_relative_autoload_dir()
   mkdir('autoload', 'pR')
   var lines =<< trim END
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    346,
+/**/
     345,
 /**/
     344,