aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-15 19:50:23 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-15 21:06:16 +0800
commitbcc971de15ed540356405f937d640eaffa4a03bb (patch)
treeebd853d8e81134cd7dad02ed4c7bd51849f8683b /test
parenteb151a9730f0000ff46e0b3467e29bb9f02ae362 (diff)
downloadrneovim-bcc971de15ed540356405f937d640eaffa4a03bb.tar.gz
rneovim-bcc971de15ed540356405f937d640eaffa4a03bb.tar.bz2
rneovim-bcc971de15ed540356405f937d640eaffa4a03bb.zip
vim-patch:9.0.0269: getscriptinfo() does not include the version
Problem: getscriptinfo() does not include the version. Cannot select entries by script name. Solution: Add the "version" item and the "name" argument. (Yegappan Lakshmanan, closes vim/vim#10962) https://github.com/vim/vim/commit/520f6ef60a59f7b5f3da9199999d13dbe817d3ce Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_scriptnames.vim30
1 files changed, 26 insertions, 4 deletions
diff --git a/test/old/testdir/test_scriptnames.vim b/test/old/testdir/test_scriptnames.vim
index 06ae305ab7..a04cce3b44 100644
--- a/test/old/testdir/test_scriptnames.vim
+++ b/test/old/testdir/test_scriptnames.vim
@@ -31,12 +31,34 @@ endfunc
" Test for the getscriptinfo() function
func Test_getscriptinfo()
- call writefile(['let loaded_script_id = expand("<SID>")'], 'Xscript')
- source Xscript
+ let lines =<< trim END
+ let g:loaded_script_id = expand("<SID>")
+ let s:XscriptVar = [1, #{v: 2}]
+ func s:XscriptFunc()
+ endfunc
+ END
+ call writefile(lines, 'X22script91')
+ source X22script91
let l = getscriptinfo()
- call assert_match('Xscript$', l[-1].name)
+ call assert_match('X22script91$', l[-1].name)
call assert_equal(g:loaded_script_id, $"<SNR>{l[-1].sid}_")
- call delete('Xscript')
+
+ let l = getscriptinfo({'name': '22script91'})
+ call assert_equal(1, len(l))
+ call assert_match('22script91$', l[0].name)
+
+ let l = getscriptinfo({'name': 'foobar'})
+ call assert_equal(0, len(l))
+ let l = getscriptinfo({'name': ''})
+ call assert_true(len(l) > 1)
+
+ call assert_fails("echo getscriptinfo({'name': []})", 'E730:')
+ call assert_fails("echo getscriptinfo({'name': '\\@'})", 'E866:')
+ let l = getscriptinfo({'name': v:_null_string})
+ call assert_true(len(l) > 1)
+ call assert_fails("echo getscriptinfo('foobar')", 'E1206:')
+
+ call delete('X22script91')
endfunc
" vim: shiftwidth=2 sts=2 expandtab