diff src/evalfunc.c @ 14748:00da090af0ab v8.1.0386

patch 8.1.0386: cannot test with non-default option value commit https://github.com/vim/vim/commit/fe8ef98dd1d0b7d296d7db29b1e2fd1b56b788de Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 13 20:31:54 2018 +0200 patch 8.1.0386: cannot test with non-default option value Problem: Cannot test with non-default option value. Solution: Add test_option_not_set().
author Christian Brabandt <cb@256bit.org>
date Thu, 13 Sep 2018 20:45:05 +0200
parents 193471015e1a
children c54f69fabee9
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -415,6 +415,7 @@ static void f_tempname(typval_T *argvars
 static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv);
 static void f_test_autochdir(typval_T *argvars, typval_T *rettv);
 static void f_test_feedinput(typval_T *argvars, typval_T *rettv);
+static void f_test_option_not_set(typval_T *argvars, typval_T *rettv);
 static void f_test_override(typval_T *argvars, typval_T *rettv);
 static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv);
 static void f_test_ignore_error(typval_T *argvars, typval_T *rettv);
@@ -922,6 +923,7 @@ static struct fst
     {"test_null_list",	0, 0, f_test_null_list},
     {"test_null_partial", 0, 0, f_test_null_partial},
     {"test_null_string", 0, 0, f_test_null_string},
+    {"test_option_not_set", 1, 1, f_test_option_not_set},
     {"test_override",    2, 2, f_test_override},
     {"test_settime",	1, 1, f_test_settime},
 #ifdef FEAT_TIMERS
@@ -13062,7 +13064,25 @@ f_test_feedinput(typval_T *argvars, typv
 }
 
 /*
- * "test_disable({name}, {val})" function
+ * "test_option_not_set({name})" function
+ */
+    static void
+f_test_option_not_set(typval_T *argvars, typval_T *rettv UNUSED)
+{
+    char_u *name = (char_u *)"";
+
+    if (argvars[0].v_type != VAR_STRING)
+	EMSG(_(e_invarg));
+    else
+    {
+	name = get_tv_string_chk(&argvars[0]);
+	if (reset_option_was_set(name) == FAIL)
+	    EMSG2(_(e_invarg2), name);
+    }
+}
+
+/*
+ * "test_override({name}, {val})" function
  */
     static void
 f_test_override(typval_T *argvars, typval_T *rettv UNUSED)