endif
enddef
-If you would do it like this you get an error at compile time that
-"PluginFunc" does not exist, even when "g:loaded_plugin" does not exist: >
+If you do it like this, you get an error at compile time that "PluginFunc"
+does not exist, even when "g:loaded_plugin" does not exist: >
def CallPluginFunc()
if exists('g:loaded_plugin')
PluginFunc() # Error - function not found
2. The "if" statement evaluates to true, the commands up to `endif` are
executed and `finish` bails out before reaching `vim9script`.
-TODO: The "vim9script" feature does not exist yet, it will only be added once
-the Vim9 script syntax has been fully implemented.
-
Export ~
*:export* *:exp*
source shared.vim
source screendump.vim
+def Test_vim9script_feature()
+ # example from the help, here the feature is always present
+ var lines =<< trim END
+ " old style comment
+ if !has('vim9script')
+ " legacy commands would go here
+ finish
+ endif
+ vim9script
+ # Vim9 script commands go here
+ g:didit = true
+ END
+ CheckScriptSuccess(lines)
+ assert_equal(true, g:didit)
+ unlet g:didit
+enddef
+
def Test_range_only()
new
setline(1, ['blah', 'Blah'])