diff src/testdir/test_vim9_script.vim @ 26873:be85735650f7 v8.2.3965

patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported Commit: https://github.com/vim/vim/commit/b79ee0c299d786627784f7304ba84b80e78ece26 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 1 12:17:00 2022 +0000 patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported Problem: Vim9: no easy way to check if Vim9 script is supported. Solution: Add has('vim9script').
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Jan 2022 13:30:03 +0100
parents dcd1c244e332
children 8796f1384750
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -7,6 +7,23 @@ source vim9.vim
 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'])