summaryrefslogtreecommitdiff
path: root/src/testdir/test_vim9_import.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_vim9_import.vim')
-rw-r--r--src/testdir/test_vim9_import.vim28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim
index e6d972896..1cf1eb069 100644
--- a/src/testdir/test_vim9_import.vim
+++ b/src/testdir/test_vim9_import.vim
@@ -759,6 +759,34 @@ def Run_Test_import_in_diffexpr()
bwipe!
enddef
+def Test_import_in_formatexpr()
+ var lines =<< trim END
+ vim9script
+ export def MyFormatExpr(): number
+ g:did_format = 'yes'
+ return 0
+ enddef
+ END
+ writefile(lines, 'Xformatter')
+
+ lines =<< trim END
+ vim9script
+ import './Xformatter' as format
+ set formatexpr=format.MyFormatExpr()
+ END
+ CheckScriptSuccess(lines)
+
+ new
+ setline(1, ['a', 'b', 'c'])
+ normal gqG
+ assert_equal('yes', g:did_format)
+
+ bwipe!
+ delete('Xformatter')
+ unlet g:did_format
+ set formatexpr=
+enddef
+
def Test_export_fails()
CheckScriptFailure(['export var some = 123'], 'E1042:')
CheckScriptFailure(['vim9script', 'export var g:some'], 'E1022:')