0
0
mirror of https://github.com/vim/vim.git synced 2025-10-28 09:27:14 -04:00
Files
vim/src/testdir/test_scriptnames.vim
Bram Moolenaar 6d91bcb4d2 patch 8.2.1432: various inconsistencies in test files
Problem:    Various inconsistencies in test files.
Solution:   Add modelines where they were missing.  Use Check commands instead
            of silently skipping over tests.  Adjust indents and comments.
            (Ken Takata, closes #6695)
2020-08-12 18:50:36 +02:00

29 lines
769 B
VimL

" 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
" vim: shiftwidth=2 sts=2 expandtab