Patch 8.0.1793
Problem:    No test for "vim -g".
Solution:   Add a test.
Files:      src/testdir/shared.vim, src/testdir/test_gui.vim


*** ../vim-8.0.1792/src/testdir/shared.vim      2018-04-28 21:34:35.862806140 
+0200
--- src/testdir/shared.vim      2018-05-05 15:42:51.007619663 +0200
***************
*** 227,232 ****
--- 227,234 ----
    return readfile('vimcmd')[0]
  endfunc
  
+ let g:valgrind_cnt = 1
+ 
  " Get the command to run Vim, with -u NONE and --not-a-term arguments.
  " If there is an argument use it instead of "NONE".
  func GetVimCommand(...)
***************
*** 244,257 ****
    " For Unix Makefile writes the command to use in the second line of the
    " "vimcmd" file, including environment options.
    " Other Makefiles just write the executable in the first line, so fall back
!   " to that if there is no second line.
!   let cmd = get(lines, 1, lines[0])
    let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '')
    if cmd !~ '-u '. name
      let cmd = cmd . ' -u ' . name
    endif
    let cmd .= ' --not-a-term'
    let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '')
    return cmd
  endfunc
  
--- 246,271 ----
    " For Unix Makefile writes the command to use in the second line of the
    " "vimcmd" file, including environment options.
    " Other Makefiles just write the executable in the first line, so fall back
!   " to that if there is no second line or it is empty.
!   if len(lines) > 1 && lines[1] != ''
!     let cmd = lines[1]
!   else
!     let cmd = lines[0]
!   endif
! 
    let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '')
    if cmd !~ '-u '. name
      let cmd = cmd . ' -u ' . name
    endif
    let cmd .= ' --not-a-term'
    let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '')
+ 
+   " If using valgrind, make sure every run uses a different log file.
+   if cmd =~ 'valgrind.*--log-file='
+     let cmd = substitute(cmd, '--log-file=\(^\s*\)', '--log-file=\1.' . 
g:valgrind_cnt, '')
+     let g:valgrind_cnt += 1
+   endif
+ 
    return cmd
  endfunc
  
***************
*** 274,282 ****
  
  func RunVimPiped(before, after, arguments, pipecmd)
    let cmd = GetVimCommand()
-   if cmd == ''
-     return 0
-   endif
    let args = ''
    if len(a:before) > 0
      call writefile(a:before, 'Xbefore.vim')
--- 288,293 ----
*** ../vim-8.0.1792/src/testdir/test_gui.vim    2018-04-30 15:40:39.485735708 
+0200
--- src/testdir/test_gui.vim    2018-05-05 15:46:14.954434610 +0200
***************
*** 706,708 ****
--- 706,738 ----
      call assert_equal(0, v:windowid)
    endif
  endfunc
+ 
+ " Test "vim -g" and also the GUIEnter autocommand.
+ func Test_gui_dash_g()
+   let cmd = GetVimCommand('Xscriptgui')
+   call writefile([""], "Xtestgui")
+   call writefile([
+       \ 'au GUIEnter * call writefile(["insertmode: " . &insertmode], 
"Xtestgui")',
+       \ 'au GUIEnter * qall',
+       \ ], 'Xscriptgui')
+   call system(cmd . ' -g')
+   call WaitForAssert({-> assert_equal(['insertmode: 0'], 
readfile('Xtestgui'))})
+ 
+   call delete('Xscriptgui')
+   call delete('Xtestgui')
+ endfunc
+ 
+ " Test "vim -7" and also the GUIEnter autocommand.
+ func Test_gui_dash_y()
+   let cmd = GetVimCommand('Xscriptgui')
+   call writefile([""], "Xtestgui")
+   call writefile([
+       \ 'au GUIEnter * call writefile(["insertmode: " . &insertmode], 
"Xtestgui")',
+       \ 'au GUIEnter * qall',
+       \ ], 'Xscriptgui')
+   call system(cmd . ' -y')
+   call WaitForAssert({-> assert_equal(['insertmode: 1'], 
readfile('Xtestgui'))})
+ 
+   call delete('Xscriptgui')
+   call delete('Xtestgui')
+ endfunc
*** ../vim-8.0.1792/src/version.c       2018-05-05 15:09:47.030658365 +0200
--- src/version.c       2018-05-05 15:46:58.538180440 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1793,
  /**/

-- 
Witches prefer brooms: vacuum-cleaners need extension cords!

 /// 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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui