view src/testdir/test_startup.vim @ 9788:3fdf6caf42f7 v7.4.2169

commit https://github.com/vim/vim/commit/446cce6d537b036467033975a86729dbdc83f860 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 6 21:37:27 2016 +0200 patch 7.4.2169 Problem: Startup test gets stuck on MS-Windows. Solution: Use double quotes.
author Christian Brabandt <cb@256bit.org>
date Sat, 06 Aug 2016 21:45:05 +0200
parents d6a69f968249
children fd32f719d34f
line wrap: on
line source

" Tests for startup.

source shared.vim

" Check that loading startup.vim works.
func Test_startup_script()
  set compatible
  source $VIMRUNTIME/defaults.vim

  call assert_equal(0, &compatible)
endfunc

" Verify the order in which plugins are loaded:
" 1. plugins in non-after directories
" 2. packages
" 3. plugins in after directories
func Test_after_comes_later()
  if !has('packages')
    return
  endif
  let before = [
	\ 'set nocp viminfo+=nviminfo',
	\ 'set guioptions+=M',
	\ 'let $HOME = "/does/not/exist"',
	\ 'set loadplugins',
	\ 'set rtp=Xhere,Xafter',
	\ 'set packpath=Xhere,Xafter',
	\ 'set nomore',
	\ ]
  let after = [
	\ 'redir! > Xtestout',
	\ 'scriptnames',
	\ 'redir END',
	\ 'quit',
	\ ]
  call mkdir('Xhere/plugin', 'p')
  call writefile(['let done = 1'], 'Xhere/plugin/here.vim')
  call mkdir('Xhere/pack/foo/start/foobar/plugin', 'p')
  call writefile(['let done = 1'], 'Xhere/pack/foo/start/foobar/plugin/foo.vim')

  call mkdir('Xafter/plugin', 'p')
  call writefile(['let done = 1'], 'Xafter/plugin/later.vim')

  if RunVim(before, after)

    let lines = readfile('Xtestout')
    let expected = ['Xbefore.vim', 'here.vim', 'foo.vim', 'later.vim', 'Xafter.vim']
    let found = []
    for line in lines
      for one in expected
	if line =~ one
	  call add(found, one)
	endif
      endfor
    endfor
    call assert_equal(expected, found)
  endif

  call delete('Xtestout')
  call delete('Xhere', 'rf')
  call delete('Xafter', 'rf')
endfunc