Merge pull request #13197 from janlazo/vim-8.2.1925

vim-patch:8.2.{639,666,1925,1926,1929,1932}
This commit is contained in:
Jan Edmund Lazo
2020-11-01 12:03:56 -05:00
committed by GitHub
7 changed files with 52 additions and 58 deletions

View File

@@ -941,8 +941,10 @@ EXTERN char_u e_readonly[] INIT(= N_(
EXTERN char_u e_readonlyvar[] INIT(= N_( EXTERN char_u e_readonlyvar[] INIT(= N_(
"E46: Cannot change read-only variable \"%.*s\"")); "E46: Cannot change read-only variable \"%.*s\""));
EXTERN char_u e_dictreq[] INIT(= N_("E715: Dictionary required")); EXTERN char_u e_dictreq[] INIT(= N_("E715: Dictionary required"));
EXTERN char_u e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s")); EXTERN char_u e_toomanyarg[] INIT(= N_(
EXTERN char_u e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s")); "E118: Too many arguments for function: %s"));
EXTERN char_u e_dictkey[] INIT(= N_(
"E716: Key not present in Dictionary: \"%s\""));
EXTERN char_u e_listreq[] INIT(= N_("E714: List required")); EXTERN char_u e_listreq[] INIT(= N_("E714: List required"));
EXTERN char_u e_listdictarg[] INIT(= N_( EXTERN char_u e_listdictarg[] INIT(= N_(
"E712: Argument of %s must be a List or Dictionary")); "E712: Argument of %s must be a List or Dictionary"));

View File

@@ -2566,7 +2566,7 @@ static bool valid_spellfile(const char_u *val)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{ {
for (const char_u *s = val; *s != NUL; s++) { for (const char_u *s = val; *s != NUL; s++) {
if (!vim_isfilec(*s) && *s != ',') { if (!vim_isfilec(*s) && *s != ',' && *s != ' ') {
return false; return false;
} }
} }

View File

@@ -199,9 +199,9 @@ func Test_dict_big()
try try
let n = d[1500] let n = d[1500]
catch catch
let str=substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '') let str = substitute(v:exception, '\v(.{14}).*( "\d{4}").*', '\1\2', '')
endtry endtry
call assert_equal('Vim(let):E716: 1500', str) call assert_equal('Vim(let):E716: "1500"', str)
" lookup each items " lookup each items
for i in range(1500) for i in range(1500)

View File

@@ -1,20 +1,16 @@
" Tests for :messages, :echomsg, :echoerr " Tests for :messages, :echomsg, :echoerr
function Test_messages() source shared.vim
func Test_messages()
let oldmore = &more let oldmore = &more
try try
set nomore set nomore
" Avoid the "message maintainer" line.
let $LANG = ''
let $LC_ALL = ''
let $LC_MESSAGES = ''
let $LC_COLLATE = ''
let arr = map(range(10), '"hello" . v:val') let arr = map(range(10), '"hello" . v:val')
for s in arr for s in arr
echomsg s | redraw echomsg s | redraw
endfor endfor
let result = ''
" get last two messages " get last two messages
redir => result redir => result
@@ -25,22 +21,17 @@ function Test_messages()
" clear messages without last one " clear messages without last one
1messages clear 1messages clear
redir => result let msg_list = GetMessages()
redraw | messages
redir END
let msg_list = split(result, "\n")
call assert_equal(['hello9'], msg_list) call assert_equal(['hello9'], msg_list)
" clear all messages " clear all messages
messages clear messages clear
redir => result let msg_list = GetMessages()
redraw | messages call assert_equal([], msg_list)
redir END
call assert_equal('', result)
finally finally
let &more = oldmore let &more = oldmore
endtry endtry
endfunction endfunc
" Patch 7.4.1696 defined the "clearmode()" command for clearing the mode " Patch 7.4.1696 defined the "clearmode()" command for clearing the mode
" indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message " indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message

View File

@@ -1,8 +1,7 @@
" Tests for ruby interface " Tests for ruby interface
if !has('ruby') source check.vim
finish CheckFeature ruby
end
func Test_ruby_change_buffer() func Test_ruby_change_buffer()
call setline(line('$'), ['1 line 1']) call setline(line('$'), ['1 line 1'])
@@ -36,7 +35,7 @@ func Test_rubyfile()
call delete(tempfile) call delete(tempfile)
endfunc endfunc
func Test_set_cursor() func Test_ruby_set_cursor()
" Check that setting the cursor position works. " Check that setting the cursor position works.
new new
call setline(1, ['first line', 'second line']) call setline(1, ['first line', 'second line'])
@@ -56,7 +55,7 @@ func Test_set_cursor()
endfunc endfunc
" Test buffer.count and buffer.length (number of lines in buffer) " Test buffer.count and buffer.length (number of lines in buffer)
func Test_buffer_count() func Test_ruby_buffer_count()
new new
call setline(1, ['one', 'two', 'three']) call setline(1, ['one', 'two', 'three'])
call assert_equal(3, rubyeval('$curbuf.count')) call assert_equal(3, rubyeval('$curbuf.count'))
@@ -65,7 +64,7 @@ func Test_buffer_count()
endfunc endfunc
" Test buffer.name (buffer name) " Test buffer.name (buffer name)
func Test_buffer_name() func Test_ruby_buffer_name()
new Xfoo new Xfoo
call assert_equal(expand('%:p'), rubyeval('$curbuf.name')) call assert_equal(expand('%:p'), rubyeval('$curbuf.name'))
bwipe bwipe
@@ -73,7 +72,7 @@ func Test_buffer_name()
endfunc endfunc
" Test buffer.number (number of the buffer). " Test buffer.number (number of the buffer).
func Test_buffer_number() func Test_ruby_buffer_number()
new new
call assert_equal(bufnr('%'), rubyeval('$curbuf.number')) call assert_equal(bufnr('%'), rubyeval('$curbuf.number'))
new new
@@ -83,7 +82,7 @@ func Test_buffer_number()
endfunc endfunc
" Test buffer.delete({n}) (delete line {n}) " Test buffer.delete({n}) (delete line {n})
func Test_buffer_delete() func Test_ruby_buffer_delete()
new new
call setline(1, ['one', 'two', 'three']) call setline(1, ['one', 'two', 'three'])
ruby $curbuf.delete(2) ruby $curbuf.delete(2)
@@ -97,7 +96,7 @@ func Test_buffer_delete()
endfunc endfunc
" Test buffer.append({str}, str) (append line {str} after line {n}) " Test buffer.append({str}, str) (append line {str} after line {n})
func Test_buffer_append() func Test_ruby_buffer_append()
new new
ruby $curbuf.append(0, 'one') ruby $curbuf.append(0, 'one')
ruby $curbuf.append(1, 'three') ruby $curbuf.append(1, 'three')
@@ -117,7 +116,7 @@ func Test_buffer_append()
endfunc endfunc
" Test buffer.line (get or set the current line) " Test buffer.line (get or set the current line)
func Test_buffer_line() func Test_ruby_buffer_line()
new new
call setline(1, ['one', 'two', 'three']) call setline(1, ['one', 'two', 'three'])
2 2
@@ -130,7 +129,7 @@ func Test_buffer_line()
endfunc endfunc
" Test buffer.line_number (get current line number) " Test buffer.line_number (get current line number)
func Test_buffer_line_number() func Test_ruby_buffer_line_number()
new new
call setline(1, ['one', 'two', 'three']) call setline(1, ['one', 'two', 'three'])
2 2
@@ -139,7 +138,7 @@ func Test_buffer_line_number()
bwipe! bwipe!
endfunc endfunc
func Test_buffer_get() func Test_ruby_buffer_get()
new new
call setline(1, ['one', 'two']) call setline(1, ['one', 'two'])
call assert_equal('one', rubyeval('$curbuf[1]')) call assert_equal('one', rubyeval('$curbuf[1]'))
@@ -153,7 +152,7 @@ func Test_buffer_get()
bwipe! bwipe!
endfunc endfunc
func Test_buffer_set() func Test_ruby_buffer_set()
new new
call setline(1, ['one', 'two']) call setline(1, ['one', 'two'])
ruby $curbuf[2] = 'TWO' ruby $curbuf[2] = 'TWO'
@@ -169,7 +168,7 @@ func Test_buffer_set()
endfunc endfunc
" Test window.width (get or set window height). " Test window.width (get or set window height).
func Test_window_height() func Test_ruby_window_height()
new new
" Test setting window height " Test setting window height
@@ -183,7 +182,7 @@ func Test_window_height()
endfunc endfunc
" Test window.width (get or set window width). " Test window.width (get or set window width).
func Test_window_width() func Test_ruby_window_width()
vnew vnew
" Test setting window width " Test setting window width
@@ -197,7 +196,7 @@ func Test_window_width()
endfunc endfunc
" Test window.buffer (get buffer object of a window object). " Test window.buffer (get buffer object of a window object).
func Test_window_buffer() func Test_ruby_window_buffer()
new Xfoo1 new Xfoo1
new Xfoo2 new Xfoo2
ruby $b2 = $curwin.buffer ruby $b2 = $curwin.buffer
@@ -216,14 +215,14 @@ func Test_window_buffer()
endfunc endfunc
" Test Vim::Window.current (get current window object) " Test Vim::Window.current (get current window object)
func Test_Vim_window_current() func Test_ruby_Vim_window_current()
let cw = rubyeval('$curwin.to_s') let cw = rubyeval('$curwin.to_s')
" call assert_equal(cw, rubyeval('Vim::Window.current')) " call assert_equal(cw, rubyeval('Vim::Window.current'))
call assert_match('^#<Neovim::Window:0x\x\+>$', cw) call assert_match('^#<Neovim::Window:0x\x\+>$', cw)
endfunc endfunc
" Test Vim::Window.count (number of windows) " Test Vim::Window.count (number of windows)
func Test_Vim_window_count() func Test_ruby_Vim_window_count()
new Xfoo1 new Xfoo1
new Xfoo2 new Xfoo2
split split
@@ -233,7 +232,7 @@ func Test_Vim_window_count()
endfunc endfunc
" Test Vim::Window[n] (get window object of window n) " Test Vim::Window[n] (get window object of window n)
func Test_Vim_window_get() func Test_ruby_Vim_window_get()
new Xfoo1 new Xfoo1
new Xfoo2 new Xfoo2
call assert_match('Xfoo2$', rubyeval('Vim::Window[0].buffer.name')) call assert_match('Xfoo2$', rubyeval('Vim::Window[0].buffer.name'))
@@ -245,14 +244,14 @@ func Test_Vim_window_get()
endfunc endfunc
" Test Vim::Buffer.current (return the buffer object of current buffer) " Test Vim::Buffer.current (return the buffer object of current buffer)
func Test_Vim_buffer_current() func Test_ruby_Vim_buffer_current()
let cb = rubyeval('$curbuf.to_s') let cb = rubyeval('$curbuf.to_s')
" call assert_equal(cb, rubyeval('Vim::Buffer.current')) " call assert_equal(cb, rubyeval('Vim::Buffer.current'))
call assert_match('^#<Neovim::Buffer:0x\x\+>$', cb) call assert_match('^#<Neovim::Buffer:0x\x\+>$', cb)
endfunc endfunc
" Test Vim::Buffer:.count (return the number of buffers) " Test Vim::Buffer:.count (return the number of buffers)
func Test_Vim_buffer_count() func Test_ruby_Vim_buffer_count()
new Xfoo1 new Xfoo1
new Xfoo2 new Xfoo2
call assert_equal(3, rubyeval('Vim::Buffer.count')) call assert_equal(3, rubyeval('Vim::Buffer.count'))
@@ -261,7 +260,7 @@ func Test_Vim_buffer_count()
endfunc endfunc
" Test Vim::buffer[n] (return the buffer object of buffer number n) " Test Vim::buffer[n] (return the buffer object of buffer number n)
func Test_Vim_buffer_get() func Test_ruby_Vim_buffer_get()
new Xfoo1 new Xfoo1
new Xfoo2 new Xfoo2
@@ -276,7 +275,7 @@ endfunc
" Test Vim::command({cmd}) (execute a Ex command)) " Test Vim::command({cmd}) (execute a Ex command))
" Test Vim::command({cmd}) " Test Vim::command({cmd})
func Test_Vim_command() func Test_ruby_Vim_command()
new new
call setline(1, ['one', 'two', 'three', 'four']) call setline(1, ['one', 'two', 'three', 'four'])
ruby Vim::command('2,3d') ruby Vim::command('2,3d')
@@ -285,7 +284,7 @@ func Test_Vim_command()
endfunc endfunc
" Test Vim::set_option (set a vim option) " Test Vim::set_option (set a vim option)
func Test_Vim_set_option() func Test_ruby_Vim_set_option()
call assert_equal(0, &number) call assert_equal(0, &number)
ruby Vim::set_option('number') ruby Vim::set_option('number')
call assert_equal(1, &number) call assert_equal(1, &number)
@@ -293,14 +292,16 @@ func Test_Vim_set_option()
call assert_equal(0, &number) call assert_equal(0, &number)
endfunc endfunc
func Test_Vim_evaluate() func Test_ruby_Vim_evaluate()
call assert_equal(123, rubyeval('Vim::evaluate("123")')) call assert_equal(123, rubyeval('Vim::evaluate("123")'))
" Vim::evaluate("123").class gives Integer or Fixnum depending " Vim::evaluate("123").class gives Integer or Fixnum depending
" on versions of Ruby. " on versions of Ruby.
call assert_match('^Integer\|Fixnum$', rubyeval('Vim::evaluate("123").class')) call assert_match('^Integer\|Fixnum$', rubyeval('Vim::evaluate("123").class'))
call assert_equal(1.23, rubyeval('Vim::evaluate("1.23")')) if has('float')
call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class')) call assert_equal(1.23, rubyeval('Vim::evaluate("1.23")'))
call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class'))
endif
call assert_equal('foo', rubyeval('Vim::evaluate("\"foo\"")')) call assert_equal('foo', rubyeval('Vim::evaluate("\"foo\"")'))
call assert_equal('String', rubyeval('Vim::evaluate("\"foo\"").class')) call assert_equal('String', rubyeval('Vim::evaluate("\"foo\"").class'))
@@ -323,7 +324,7 @@ func Test_Vim_evaluate()
call assert_equal('FalseClass',rubyeval('Vim::evaluate("v:false").class')) call assert_equal('FalseClass',rubyeval('Vim::evaluate("v:false").class'))
endfunc endfunc
func Test_Vim_evaluate_list() func Test_ruby_Vim_evaluate_list()
call setline(line('$'), ['2 line 2']) call setline(line('$'), ['2 line 2'])
ruby Vim.command("normal /^2\n") ruby Vim.command("normal /^2\n")
let l = ["abc", "def"] let l = ["abc", "def"]
@@ -337,7 +338,7 @@ EOF
call assert_equal('abc/def', getline('$')) call assert_equal('abc/def', getline('$'))
endfunc endfunc
func Test_Vim_evaluate_dict() func Test_ruby_Vim_evaluate_dict()
let d = {'a': 'foo', 'b': 123} let d = {'a': 'foo', 'b': 123}
redir => l:out redir => l:out
ruby d = Vim.evaluate("d"); print d ruby d = Vim.evaluate("d"); print d
@@ -346,14 +347,14 @@ func Test_Vim_evaluate_dict()
endfunc endfunc
" Test Vim::message({msg}) (display message {msg}) " Test Vim::message({msg}) (display message {msg})
func Test_Vim_message() func Test_ruby_Vim_message()
throw 'skipped: TODO: ' throw 'skipped: TODO: '
ruby Vim::message('A message') ruby Vim::message('A message')
let messages = split(execute('message'), "\n") let messages = split(execute('message'), "\n")
call assert_equal('A message', messages[-1]) call assert_equal('A message', messages[-1])
endfunc endfunc
func Test_print() func Test_ruby_print()
func RubyPrint(expr) func RubyPrint(expr)
return trim(execute('ruby print ' . a:expr)) return trim(execute('ruby print ' . a:expr))
endfunc endfunc
@@ -372,9 +373,9 @@ func Test_print()
delfunc RubyPrint delfunc RubyPrint
endfunc endfunc
func Test_p() func Test_ruby_p()
ruby p 'Just a test' ruby p 'Just a test'
let messages = split(execute('message'), "\n") let messages = GetMessages()
call assert_equal('"Just a test"', messages[-1]) call assert_equal('"Just a test"', messages[-1])
" Check return values of p method " Check return values of p method
@@ -387,6 +388,6 @@ func Test_p()
messages clear messages clear
call assert_equal(v:true, rubyeval('p() == nil')) call assert_equal(v:true, rubyeval('p() == nil'))
let messages = split(execute('message'), "\n") let messages = GetMessages()
call assert_equal(0, len(messages)) call assert_equal(0, len(messages))
endfunc endfunc

View File

@@ -132,7 +132,7 @@ describe('NULL', function()
end) end)
describe('dict', function() describe('dict', function()
it('does not crash when indexing NULL dict', function() it('does not crash when indexing NULL dict', function()
eq('\nE716: Key not present in Dictionary: test\nE15: Invalid expression: v:_null_dict.test', eq('\nE716: Key not present in Dictionary: "test"\nE15: Invalid expression: v:_null_dict.test',
redir_exec('echo v:_null_dict.test')) redir_exec('echo v:_null_dict.test'))
end) end)
null_expr_test('makes extend error out', 'extend(D, {})', 'E742: Cannot change value of extend() argument', 0) null_expr_test('makes extend error out', 'extend(D, {})', 'E742: Cannot change value of extend() argument', 0)

View File

@@ -229,7 +229,7 @@ describe('list and dictionary types', function()
try try
let n = d[1500] let n = d[1500]
catch catch
$put =substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '') $put = substitute(v:exception, '\v(.{14}).*( \"\d{4}\").*', '\1\2', '')
endtry endtry
" Lookup each items. " Lookup each items.
for i in range(1500) for i in range(1500)
@@ -260,7 +260,7 @@ describe('list and dictionary types', function()
expect([[ expect([[
3000 2900 2001 1600 1501 3000 2900 2001 1600 1501
Vim(let):E716: 1500 Vim(let):E716: "1500"
NONE 2999 NONE 2999
33=999 33=999
{'33': 999}]]) {'33': 999}]])