view src/testdir/test_scriptnames.vim @ 18514:39b0c28fe495 v8.1.2251

patch 8.1.2251: ":term command" may not work without a shell Commit: https://github.com/vim/vim/commit/197c6b7da3ad4c3e3942a553f5dbc35722a4a349 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 3 23:37:12 2019 +0100 patch 8.1.2251: ":term command" may not work without a shell Problem: ":term command" may not work without a shell. Solution: Add the ++shell option to :term. (closes https://github.com/vim/vim/issues/3340)
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 Nov 2019 23:45:03 +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