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_(
"E46: Cannot change read-only variable \"%.*s\""));
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_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s"));
EXTERN char_u e_toomanyarg[] INIT(= N_(
"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_listdictarg[] INIT(= N_(
"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
{
for (const char_u *s = val; *s != NUL; s++) {
if (!vim_isfilec(*s) && *s != ',') {
if (!vim_isfilec(*s) && *s != ',' && *s != ' ') {
return false;
}
}

View File

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

View File

@@ -1,20 +1,16 @@
" Tests for :messages, :echomsg, :echoerr
function Test_messages()
source shared.vim
func Test_messages()
let oldmore = &more
try
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')
for s in arr
echomsg s | redraw
endfor
let result = ''
" get last two messages
redir => result
@@ -25,22 +21,17 @@ function Test_messages()
" clear messages without last one
1messages clear
redir => result
redraw | messages
redir END
let msg_list = split(result, "\n")
let msg_list = GetMessages()
call assert_equal(['hello9'], msg_list)
" clear all messages
messages clear
redir => result
redraw | messages
redir END
call assert_equal('', result)
let msg_list = GetMessages()
call assert_equal([], msg_list)
finally
let &more = oldmore
endtry
endfunction
endfunc
" Patch 7.4.1696 defined the "clearmode()" command for clearing the mode
" indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message

View File

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