diff src/testdir/test_vim9_builtin.vim @ 25479:fbdfa533001c v8.2.3276

patch 8.2.3276: Vim9: exists() can only be evaluated at runtime Commit: https://github.com/vim/vim/commit/bb7ee7abe1ea1e60b8a5dadd2bed8cdbe4f3e8fb Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 2 20:06:50 2021 +0200 patch 8.2.3276: Vim9: exists() can only be evaluated at runtime Problem: Vim9: exists() can only be evaluated at runtime. Solution: Evaluate at compile time for option name literals. (closes https://github.com/vim/vim/issues/8437)
author Bram Moolenaar <Bram@vim.org>
date Mon, 02 Aug 2021 20:15:03 +0200
parents 5dce28f92d04
children 8880eb140a00
line wrap: on
line diff
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -790,6 +790,25 @@ enddef
 def Test_exists()
   CheckDefAndScriptFailure2(['exists(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
   call assert_equal(1, exists('&tabstop'))
+
+  if exists('+newoption')
+    if &newoption == 'ok'
+    endif
+  endif
+  if exists('&newoption')
+    if &newoption == 'ok'
+    endif
+  endif
+  if exists('+tabstop')
+    assert_equal(8, &tabstop)
+  else
+    assert_report('tabstop option not existing?')
+  endif
+  if exists('&tabstop')
+    assert_equal(8, &tabstop)
+  else
+    assert_report('tabstop option not existing?')
+  endif
 enddef
 
 def Test_expand()