diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-23 17:59:06 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-23 17:59:06 +0000 |
commit | 2a7aa834583dea157eccf3e69827d2ff1d9fe9c7 (patch) | |
tree | 9ee271aec0458c30d1b40e91fa987e281eed3947 /src/testdir/test_vim9_import.vim | |
parent | 428058ab3213e81531cbd7989f4267870f35d52e (diff) |
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'v8.2.4197
Problem: Cannot use an import in the "expr" part of 'spellsuggest'.
Solution: Set the script context when evaluating "expr" of 'spellsuggest'.
Diffstat (limited to 'src/testdir/test_vim9_import.vim')
-rw-r--r-- | src/testdir/test_vim9_import.vim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim index 3b7ec9cba6..8291e4a480 100644 --- a/src/testdir/test_vim9_import.vim +++ b/src/testdir/test_vim9_import.vim @@ -936,6 +936,34 @@ def Test_import_in_charconvert() set charconvert& enddef +func Test_import_in_spellsuggest_expr() + CheckFeature spell + call Run_Test_import_in_spellsuggest_expr() +endfunc + +def Run_Test_import_in_spellsuggest_expr() + var lines =<< trim END + vim9script + export def MySuggest(): list<any> + return [['Fox', 8], ['Fop', 9]] + enddef + END + writefile(lines, 'Xsuggest.vim') + + lines =<< trim END + vim9script + import './Xsuggest.vim' as sugg + set spell spellsuggest=expr:sugg.MySuggest() + END + CheckScriptSuccess(lines) + + set verbose=1 # report errors + call assert_equal(['Fox', 'Fop'], spellsuggest('Fo', 2)) + + delete('Xsuggest.vim') + set nospell spellsuggest& verbose=0 +enddef + def Test_export_fails() CheckScriptFailure(['export var some = 123'], 'E1042:') CheckScriptFailure(['vim9script', 'export var g:some'], 'E1022:') |