Patch 8.2.0299
Problem:    Vim9: ISN_STORE with argument not tested.  Some cases in tv2bool()
            not tested.
Solution:   Add tests.  Add test_unknown() and test_void().
Files:      src/testing.c, src/proto/testing.pro, src/evalfunc.c,
            src/testdir/test_vim9_disassemble.vim,
            src/testdir/test_vim9_expr.vim, runtime/doc/eval.txt,
            runtime/doc/testing.txt


*** ../vim-8.2.0298/src/testing.c       2020-02-12 22:15:14.856205206 +0100
--- src/testing.c       2020-02-22 18:59:52.931596959 +0100
***************
*** 896,901 ****
--- 896,913 ----
      rettv->vval.v_string = NULL;
  }
  
+     void
+ f_test_unknown(typval_T *argvars UNUSED, typval_T *rettv)
+ {
+     rettv->v_type = VAR_UNKNOWN;
+ }
+ 
+     void
+ f_test_void(typval_T *argvars UNUSED, typval_T *rettv)
+ {
+     rettv->v_type = VAR_VOID;
+ }
+ 
  #ifdef FEAT_GUI
      void
  f_test_scrollbar(typval_T *argvars, typval_T *rettv UNUSED)
*** ../vim-8.2.0298/src/proto/testing.pro       2020-02-12 22:15:14.856205206 
+0100
--- src/proto/testing.pro       2020-02-22 19:01:37.999167549 +0100
***************
*** 28,33 ****
--- 28,35 ----
  void f_test_null_list(typval_T *argvars, typval_T *rettv);
  void f_test_null_partial(typval_T *argvars, typval_T *rettv);
  void f_test_null_string(typval_T *argvars, typval_T *rettv);
+ void f_test_unknown(typval_T *argvars, typval_T *rettv);
+ void f_test_void(typval_T *argvars, typval_T *rettv);
  void f_test_scrollbar(typval_T *argvars, typval_T *rettv);
  void f_test_setmouse(typval_T *argvars, typval_T *rettv);
  void f_test_settime(typval_T *argvars, typval_T *rettv);
*** ../vim-8.2.0298/src/evalfunc.c      2020-02-17 22:11:39.666644199 +0100
--- src/evalfunc.c      2020-02-22 19:01:30.867197104 +0100
***************
*** 821,826 ****
--- 821,828 ----
      {"test_setmouse", 2, 2, 0,          &t_void,      f_test_setmouse},
      {"test_settime",  1, 1, FEARG_1,    &t_void,      f_test_settime},
      {"test_srand_seed",       0, 1, FEARG_1,    &t_void,      
f_test_srand_seed},
+     {"test_unknown",  0, 0, 0,          &t_any,       f_test_unknown},
+     {"test_void",     0, 0, 0,          &t_any,       f_test_void},
  #ifdef FEAT_TIMERS
      {"timer_info",    0, 1, FEARG_1,    &t_list_dict_any, f_timer_info},
      {"timer_pause",   2, 2, FEARG_1,    &t_void,      f_timer_pause},
*** ../vim-8.2.0298/src/testdir/test_vim9_disassemble.vim       2020-02-19 
14:17:15.340344660 +0100
--- src/testdir/test_vim9_disassemble.vim       2020-02-22 18:47:48.790100249 
+0100
***************
*** 221,226 ****
--- 221,243 ----
          \, res)
  enddef
  
+ 
+ def FuncWithDefault(arg: string = 'default'): string
+   return arg
+ enddef
+ 
+ def Test_disassemble_call_default()
+   let res = execute('disass FuncWithDefault')
+   assert_match('FuncWithDefault.*'
+         \ .. '\d PUSHS "default".*'
+         \ .. '\d STORE arg\[-1].*'
+         \ .. 'return arg.*'
+         \ .. '\d LOAD arg\[-1].*'
+         \ .. '\d RETURN.*'
+         \, res)
+ enddef
+ 
+ 
  def HasEval()
    if has("eval")
      echo "yes"
*** ../vim-8.2.0298/src/testdir/test_vim9_expr.vim      2020-02-20 
23:08:30.746951116 +0100
--- src/testdir/test_vim9_expr.vim      2020-02-22 18:59:40.543639818 +0100
***************
*** 765,770 ****
--- 765,787 ----
    assert_equal(false, ![2])
    assert_equal(true, !!'asdf')
    assert_equal(true, !![2])
+ 
+   assert_equal(true, !test_null_partial())
+   assert_equal(false, !{-> 'yes'})
+ 
+   assert_equal(true, !test_null_dict())
+   assert_equal(true, !{})
+   assert_equal(false, !{'yes': 'no'})
+ 
+   assert_equal(true, !test_null_job())
+   assert_equal(true, !test_null_channel())
+ 
+   assert_equal(true, !test_null_blob())
+   assert_equal(true, !0z)
+   assert_equal(false, !0z01)
+ 
+   assert_equal(true, !test_void())
+   assert_equal(true, !test_unknown())
  enddef
  
  func Test_expr7_fails()
*** ../vim-8.2.0298/runtime/doc/eval.txt        2020-02-22 14:26:39.248757828 
+0100
--- runtime/doc/eval.txt        2020-02-22 19:04:35.090449865 +0100
***************
*** 2862,2867 ****
--- 2864,2871 ----
  test_null_list()              List    null value for testing
  test_null_partial()           Funcref null value for testing
  test_null_string()            String  null value for testing
+ test_unknown()                        any     unknown value for testing
+ test_void()                   any     void value for testing
  test_option_not_set({name})   none    reset flag indicating option was set
  test_override({expr}, {val})  none    test with Vim internal overrides
  test_refcount({expr})         Number  get the reference count of {expr}
*** ../vim-8.2.0298/runtime/doc/testing.txt     2020-02-12 22:15:14.852205223 
+0100
--- runtime/doc/testing.txt     2020-02-22 19:05:49.214157219 +0100
***************
*** 123,128 ****
--- 123,135 ----
                Return a |String| that is null. Only useful for testing.
  
  
+ test_unknown()                                                *test_unknown()*
+               Return a value with unknown type. Only useful for testing.
+ 
+ test_void()                                           *test_void()*
+               Return a value with void type. Only useful for testing.
+ 
+ 
  test_option_not_set({name})                           *test_option_not_set()*
                Reset the flag that indicates option {name} was set.  Thus it
                looks like it still has the default value. Use like this: >
*** ../vim-8.2.0298/src/version.c       2020-02-22 18:36:18.608483742 +0100
--- src/version.c       2020-02-22 18:43:40.866956831 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     299,
  /**/

-- 
# echo reboot >universe
# chmod +x universe
# ./universe

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202002221807.01MI7tat030710%40masaka.moolenaar.net.

Raspunde prin e-mail lui