Patch 8.2.0480
Problem:    Vim9: some code is not tested.
Solution:   Add more tests.
Files:      src/testdir/test_vim9_expr.vim, src/vim9compile.c


*** ../vim-8.2.0479/src/testdir/test_vim9_expr.vim      2020-03-29 
18:40:08.853652561 +0200
--- src/testdir/test_vim9_expr.vim      2020-03-29 21:22:24.323875203 +0200
***************
*** 706,714 ****
--- 706,717 ----
    assert_equal(g:list_empty, [])
    assert_equal(g:list_empty, [  ])
    assert_equal(g:list_mixed, [1, 'b', false])
+   assert_equal('b', g:list_mixed[1])
  
    call CheckDefExecFailure("let x = g:anint[3]", 'E714:')
+   call CheckDefFailure("let x = g:list_mixed[xxx]", 'E1001:')
    call CheckDefExecFailure("let x = g:list_mixed['xx']", 'E39:')
+   call CheckDefFailure("let x = g:list_mixed[0", 'E111:')
    call CheckDefExecFailure("let x = g:list_empty[3]", 'E684:')
  enddef
  
***************
*** 739,744 ****
--- 742,753 ----
    call CheckDefExecFailure("let x = g:dict_empty.member", 'E716:')
  enddef
  
+ def Test_expr_member()
+   assert_equal(1, g:dict_one.one)
+ 
+   call CheckDefFailure("let x = g:dict_one.#$!", 'E1002:')
+ enddef
+ 
  def Test_expr7_option()
    " option
    set ts=11
***************
*** 778,783 ****
--- 787,816 ----
    assert_equal(-6, ---6)
  enddef
  
+ def Test_expr7_negate()
+   assert_equal(-99, -99)
+   assert_equal(99, --99)
+   let nr = 88
+   assert_equal(-88, -nr)
+   assert_equal(88, --nr)
+ enddef
+ 
+ def Echo(arg): string
+   return arg
+ enddef
+ 
+ def s:EchoArg(arg): string
+   return arg
+ enddef
+ 
+ def Test_expr7_call()
+   assert_equal('yes', 'yes'->Echo())
+   assert_equal('yes', 'yes'->s:EchoArg())
+ 
+   call CheckDefFailure("let x = 'yes'->Echo", 'E107:')
+ enddef
+ 
+ 
  def Test_expr7_not()
    assert_equal(true, !'')
    assert_equal(true, ![])
*** ../vim-8.2.0479/src/vim9compile.c   2020-03-28 22:06:07.587491239 +0100
--- src/vim9compile.c   2020-03-29 21:12:03.157113619 +0200
***************
*** 2622,2632 ****
            else
            {
                // method call:  list->method()
!               for (p = *arg; eval_isnamec1(*p); ++p)
                    ;
                if (*p != '(')
                {
!                   semsg(_(e_missing_paren), arg);
                    return FAIL;
                }
                // TODO: base value may not be the first argument
--- 2622,2635 ----
            else
            {
                // method call:  list->method()
!               p = *arg;
!               if (ASCII_ISALPHA(*p) && p[1] == ':')
!                   p += 2;
!               for ( ; eval_isnamec1(*p); ++p)
                    ;
                if (*p != '(')
                {
!                   semsg(_(e_missing_paren), *arg);
                    return FAIL;
                }
                // TODO: base value may not be the first argument
*** ../vim-8.2.0479/src/version.c       2020-03-29 20:51:03.085780722 +0200
--- src/version.c       2020-03-29 21:37:59.669183466 +0200
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     480,
  /**/

-- 
ARTHUR:   Ni!
BEDEVERE: Nu!
ARTHUR:   No.  Ni!  More like this. "Ni"!
BEDEVERE: Ni, ni, ni!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202003291938.02TJclcc030129%40masaka.moolenaar.net.

Raspunde prin e-mail lui