comparison src/testdir/test_startup.vim @ 16586:5ebb2c87d1f5 v8.1.1296

patch 8.1.1296: crash when using invalid command line argument commit https://github.com/vim/vim/commit/27821260c0afaac85cb1c10627f1d7fbe48860ae Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 8 16:41:09 2019 +0200 patch 8.1.1296: crash when using invalid command line argument Problem: Crash when using invalid command line argument. Solution: Check for options not being initialized.
author Bram Moolenaar <Bram@vim.org>
date Wed, 08 May 2019 16:45:07 +0200
parents 5726af4931e3
children c56fe1427025
comparison
equal deleted inserted replaced
16585:f7b1c58bcf8b 16586:5ebb2c87d1f5
406 call assert_equal('Argument missing after: "' .. opt .. '"', out[1]) 406 call assert_equal('Argument missing after: "' .. opt .. '"', out[1])
407 call assert_equal('More info with: "vim -h"', out[2]) 407 call assert_equal('More info with: "vim -h"', out[2])
408 endfor 408 endfor
409 409
410 if has('clientserver') 410 if has('clientserver')
411 " FIXME: need to add --servername to this list
412 " but it causes vim-8.1.1282 to crash!
413 for opt in ['--remote', '--remote-send', '--remote-silent', '--remote-expr', 411 for opt in ['--remote', '--remote-send', '--remote-silent', '--remote-expr',
414 \ '--remote-tab', '--remote-tab-wait', 412 \ '--remote-tab', '--remote-tab-wait',
415 \ '--remote-tab-wait-silent', '--remote-tab-silent', 413 \ '--remote-tab-wait-silent', '--remote-tab-silent',
416 \ '--remote-wait', '--remote-wait-silent', 414 \ '--remote-wait', '--remote-wait-silent',
415 \ '--servername',
417 \ ] 416 \ ]
418 let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") 417 let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
419 call assert_equal(1, v:shell_error) 418 call assert_equal(1, v:shell_error)
420 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) 419 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0])
421 call assert_equal('Argument missing after: "' .. opt .. '"', out[1]) 420 call assert_equal('Argument missing after: "' .. opt .. '"', out[1])
422 call assert_equal('More info with: "vim -h"', out[2]) 421 call assert_equal('More info with: "vim -h"', out[2])
423 endfor 422 endfor
424 endif 423 endif
425 424
426 " FIXME: commented out as this causes vim-8.1.1282 to crash! 425 if has('clipboard')
427 "if has('clipboard') 426 let out = split(system(GetVimCommand() .. ' --display'), "\n")
428 " let out = split(system(GetVimCommand() .. ' --display'), "\n") 427 call assert_equal(1, v:shell_error)
429 " call assert_equal(1, v:shell_error) 428 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0])
430 " call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) 429 call assert_equal('Argument missing after: "--display"', out[1])
431 " call assert_equal('Argument missing after: "--display"', out[1]) 430 call assert_equal('More info with: "vim -h"', out[2])
432 " call assert_equal('More info with: "vim -h"', out[2]) 431 endif
433 "endif
434 432
435 let out = split(system(GetVimCommand() .. ' -ix'), "\n") 433 let out = split(system(GetVimCommand() .. ' -ix'), "\n")
436 call assert_equal(1, v:shell_error) 434 call assert_equal(1, v:shell_error)
437 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) 435 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0])
438 call assert_equal('Garbage after option argument: "-ix"', out[1]) 436 call assert_equal('Garbage after option argument: "-ix"', out[1])
461 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) 459 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0])
462 call assert_equal('Too many "+command", "-c command" or "--cmd command" arguments', out[1]) 460 call assert_equal('Too many "+command", "-c command" or "--cmd command" arguments', out[1])
463 call assert_equal('More info with: "vim -h"', out[2]) 461 call assert_equal('More info with: "vim -h"', out[2])
464 endfor 462 endfor
465 463
466 " FIXME: commented out as this causes vim-8.1.1282 to crash! 464 if has('gui_gtk')
467 "if has('gui_gtk') 465 for opt in ['--socketid x', '--socketid 0xg']
468 " for opt in ['--socketid x', '--socketid 0xg'] 466 let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
469 " let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") 467 call assert_equal(1, v:shell_error)
470 " call assert_equal(1, v:shell_error) 468 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0])
471 " call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) 469 call assert_equal('Invalid argument for: "--socketid"', out[1])
472 " call assert_equal('Invalid argument for: "--socketid"', out[1]) 470 call assert_equal('More info with: "vim -h"', out[2])
473 " call assert_equal('More info with: "vim -h"', out[2]) 471 endfor
474 " endfor 472 endif
475 "endif
476 endfunc 473 endfunc
477 474
478 func Test_file_args() 475 func Test_file_args()
479 let after = [ 476 let after = [
480 \ 'call writefile(argv(), "Xtestout")', 477 \ 'call writefile(argv(), "Xtestout")',