summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_vim9_import.vim
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2024-04-02 20:41:04 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-02 20:41:04 +0200
commitf1750ca0c2ef91c6e4857655ca8fdf8dd8f5abb8 (patch)
treedc071ced955445307763d361fcb4eb0689d8a80e /src/testdir/test_vim9_import.vim
parent78d742ab8845578f78039ddd71a6444c6929257c (diff)
patch 9.1.0257: Vim9: :call may not find imported class membersv9.1.0257
Problem: Vim9: :call may not find imported class members (mityu) Solution: Set the typval of an imported lval variable correctly (Yegappan Lakshmanan) fixes: #14334 closes: #14386 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir/test_vim9_import.vim')
-rw-r--r--src/testdir/test_vim9_import.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim
index fa1aeb10e8..8d68f1e47e 100644
--- a/src/testdir/test_vim9_import.vim
+++ b/src/testdir/test_vim9_import.vim
@@ -2054,6 +2054,13 @@ def Test_import_vim9_from_legacy()
export def GetText(): string
return 'text'
enddef
+ export var exported_nr: number = 22
+ def AddNum(n: number)
+ exported_nr += n
+ enddef
+ export var exportedDict: dict<func> = {Fn: AddNum}
+ export const CONST = 10
+ export final finalVar = 'abc'
END
writefile(vim9_lines, 'Xvim9_export.vim', 'D')
@@ -2072,6 +2079,13 @@ def Test_import_vim9_from_legacy()
" imported symbol is script-local
call assert_equal('exported', s:vim9.exported)
call assert_equal('text', s:vim9.GetText())
+ call s:vim9.exportedDict.Fn(5)
+ call assert_equal(27, s:vim9.exported_nr)
+ call call(s:vim9.exportedDict.Fn, [3])
+ call assert_equal(30, s:vim9.exported_nr)
+ call assert_fails('let s:vim9.CONST = 20', 'E46: Cannot change read-only variable "CONST"')
+ call assert_fails('let s:vim9.finalVar = ""', 'E46: Cannot change read-only variable "finalVar"')
+ call assert_fails('let s:vim9.non_existing_var = 20', 'E1048: Item not found in script: non_existing_var')
END
writefile(legacy_lines, 'Xlegacy_script.vim', 'D')