diff src/testdir/test_gui.vim @ 26028:be2d004247e1 v8.2.3548

patch 8.2.3548: GTK GUI crashen when reading from stdin Commit: https://github.com/vim/vim/commit/d68a0044858d00de6100def1e389a3a9c1cdbcdc Author: Bram Moolenaar <Bram@vim.org> Date: Wed Oct 20 23:08:11 2021 +0100 patch 8.2.3548: GTK GUI crashen when reading from stdin Problem: GTK GUI crashen when reading from stdin. Solution: Do not overwrite the NUL after the string. (closes https://github.com/vim/vim/issues/9028)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 Oct 2021 00:15:03 +0200
parents 34b75c77a7bd
children c2c40cefc17b
line wrap: on
line diff
--- a/src/testdir/test_gui.vim
+++ b/src/testdir/test_gui.vim
@@ -145,6 +145,28 @@ func Test_quoteplus()
   let @+ = quoteplus_saved
 endfunc
 
+func Test_gui_read_stdin()
+  CheckUnix
+
+  call writefile(['some', 'lines'], 'Xstdin')
+  let script =<< trim END
+      call writefile(getline(1, '$'), 'XstdinOK')
+      qa!
+  END
+  call writefile(script, 'Xscript')
+
+  " Cannot use --not-a-term here, the "reading from stdin" message would not be
+  " displayed.
+  let vimcmd = substitute(GetVimCommand(), '--not-a-term', '', '')
+
+  call system('cat Xstdin | ' .. vimcmd .. ' -f -g -S Xscript -')
+  call assert_equal(['some', 'lines'], readfile('XstdinOK'))
+
+  call delete('Xstdin')
+  call delete('XstdinOK')
+  call delete('Xscript')
+endfunc
+
 func Test_set_background()
   let background_saved = &background