view src/testdir/test_scriptnames.vim @ 15178:5c3ca8f7adea v8.1.0599

patch 8.1.0599: without the +eval feature the indent tests don't work commit https://github.com/vim/vim/commit/eeed665b0ecd917e88e3475c9615d52546aa124d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 15 17:43:42 2018 +0100 patch 8.1.0599: without the +eval feature the indent tests don't work Problem: Without the +eval feature the indent tests don't work. Solution: Skip the body of the tests.
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Dec 2018 17:45:04 +0100
parents 1783c0b6bc2e
children 08940efa6b4e
line wrap: on
line source

" Test for :scriptnames

func Test_scriptnames()
  call writefile(['let did_load_script = 123'], 'Xscripting')
  source Xscripting
  call assert_equal(123, g:did_load_script)

  let scripts = split(execute('scriptnames'), "\n")
  let last = scripts[-1]
  call assert_match('\<Xscripting\>', last)
  let lastnr = substitute(last, '\D*\(\d\+\):.*', '\1', '')
  exe 'script ' . lastnr
  call assert_equal('Xscripting', expand('%:t'))

  call assert_fails('script ' . (lastnr + 1), 'E474:')
  call assert_fails('script 0', 'E939:')

  new
  call setline(1, 'nothing')
  call assert_fails('script ' . lastnr, 'E37:')
  exe 'script! ' . lastnr
  call assert_equal('Xscripting', expand('%:t'))

  bwipe
  call delete('Xscripting')
endfunc