diff options
-rw-r--r-- | .travis.yml | 9 | ||||
-rwxr-xr-x | ci/before_install.sh | 4 | ||||
-rwxr-xr-x | ci/install.sh | 8 | ||||
-rw-r--r-- | src/nvim/eval/typval.c | 4 | ||||
-rw-r--r-- | src/nvim/strings.c | 14 | ||||
-rw-r--r-- | src/nvim/testdir/test_python2.vim | 27 | ||||
-rw-r--r-- | src/nvim/testdir/test_python3.vim | 27 | ||||
-rw-r--r-- | test/functional/api/version_spec.lua | 84 | ||||
-rw-r--r-- | test/functional/ui/sign_spec.lua | 43 | ||||
-rw-r--r-- | third-party/CMakeLists.txt | 4 |
10 files changed, 170 insertions, 54 deletions
diff --git a/.travis.yml b/.travis.yml index 199ded7b3b..93caf9ef75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -117,10 +117,15 @@ addons: - unzip - valgrind - xclip + homebrew: + update: true + packages: + - ccache + - ninja branches: - except: - - nightly + only: + - master cache: apt: true diff --git a/ci/before_install.sh b/ci/before_install.sh index 86dd78af48..d8cf38d314 100755 --- a/ci/before_install.sh +++ b/ci/before_install.sh @@ -7,10 +7,6 @@ if [[ "${CI_TARGET}" == lint ]]; then exit fi -if [[ "${TRAVIS_OS_NAME}" == osx ]]; then - >/dev/null brew update -fi - echo 'python info:' ( 2>&1 python --version || true diff --git a/ci/install.sh b/ci/install.sh index 7efbaf33b5..12985098cd 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -8,8 +8,6 @@ if [[ "${CI_TARGET}" == lint ]]; then fi if [[ "${TRAVIS_OS_NAME}" == osx ]]; then - brew install ccache - brew install ninja export PATH="/usr/local/opt/ccache/libexec:$PATH" fi @@ -24,11 +22,11 @@ if ! [ "${TRAVIS_OS_NAME}" = osx ] ; then # Use default CC to avoid compilation problems when installing Python modules. echo "Install neovim module for Python 2." CC=cc python2.7 -m pip -q install --user --upgrade neovim - - echo "Install neovim RubyGem." - gem install --no-document --version ">= 0.2.0" neovim fi +echo "Install neovim RubyGem." +gem install --no-document --version ">= 0.8.0" neovim + echo "Install neovim npm package" npm install -g neovim npm link neovim diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 6a93b20345..912aecafec 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -2850,7 +2850,7 @@ const char *tv_get_string_buf_chk(const typval_T *const tv, char *const buf) /// Get the string value of a "stringish" VimL object. /// /// @warning For number and special values it uses a single, static buffer. It -/// may be used only once, next call to get_tv_string may reuse it. Use +/// may be used only once, next call to tv_get_string may reuse it. Use /// tv_get_string_buf() if you need to use tv_get_string() output after /// calling it again. /// @@ -2869,7 +2869,7 @@ const char *tv_get_string_chk(const typval_T *const tv) /// Get the string value of a "stringish" VimL object. /// /// @warning For number and special values it uses a single, static buffer. It -/// may be used only once, next call to get_tv_string may reuse it. Use +/// may be used only once, next call to tv_get_string may reuse it. Use /// tv_get_string_buf() if you need to use tv_get_string() output after /// calling it again. /// diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 87593f577b..4921824316 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -999,7 +999,10 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap, } else if (fmt_spec == 'd') { // signed switch (length_modifier) { - case '\0': + case '\0': { + arg = (int)(tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, int)); + break; + } case 'h': { // char and short arguments are passed as int16_t arg = (int16_t)(tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, int)); @@ -1031,11 +1034,16 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap, } else { // unsigned switch (length_modifier) { - case '\0': + case '\0': { + uarg = (unsigned int)(tvs + ? tv_nr(tvs, &arg_idx) + : va_arg(ap, unsigned int)); + break; + } case 'h': { uarg = (uint16_t)(tvs ? tv_nr(tvs, &arg_idx) - : va_arg(ap, unsigned)); + : va_arg(ap, unsigned int)); break; } case 'l': { diff --git a/src/nvim/testdir/test_python2.vim b/src/nvim/testdir/test_python2.vim index 63c38cd5d1..5ba9fd68cf 100644 --- a/src/nvim/testdir/test_python2.vim +++ b/src/nvim/testdir/test_python2.vim @@ -25,3 +25,30 @@ func Test_pydo() bwipe! endif endfunc + +func Test_vim_function() + " Check creating vim.Function object + py import vim + + func s:foo() + return matchstr(expand('<sfile>'), '<SNR>\zs\d\+_foo$') + endfunc + let name = '<SNR>' . s:foo() + + try + py f = vim.bindeval('function("s:foo")') + call assert_equal(name, pyeval('f.name')) + catch + call assert_false(v:exception) + endtry + + try + py f = vim.Function('\x80\xfdR' + vim.eval('s:foo()')) + call assert_equal(name, pyeval('f.name')) + catch + call assert_false(v:exception) + endtry + + py del f + delfunc s:foo +endfunc diff --git a/src/nvim/testdir/test_python3.vim b/src/nvim/testdir/test_python3.vim index f5b2c89853..2e3fc93674 100644 --- a/src/nvim/testdir/test_python3.vim +++ b/src/nvim/testdir/test_python3.vim @@ -25,3 +25,30 @@ func Test_py3do() bwipe! endif endfunc + +func Test_vim_function() + " Check creating vim.Function object + py3 import vim + + func s:foo() + return matchstr(expand('<sfile>'), '<SNR>\zs\d\+_foo$') + endfunc + let name = '<SNR>' . s:foo() + + try + py3 f = vim.bindeval('function("s:foo")') + call assert_equal(name, py3eval('f.name')) + catch + call assert_false(v:exception) + endtry + + try + py3 f = vim.Function(b'\x80\xfdR' + vim.eval('s:foo()').encode()) + call assert_equal(name, py3eval('f.name')) + catch + call assert_false(v:exception) + endtry + + py3 del f + delfunc s:foo +endfunc diff --git a/test/functional/api/version_spec.lua b/test/functional/api/version_spec.lua index b4ae17d963..bf67d4788b 100644 --- a/test/functional/api/version_spec.lua +++ b/test/functional/api/version_spec.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local mpack = require('mpack') local clear, funcs, eq = helpers.clear, helpers.funcs, helpers.eq local call = helpers.call +local meths = helpers.meths local function read_mpack_file(fname) local fd = io.open(fname, 'rb') @@ -43,7 +44,7 @@ describe("api_info()['version']", function() end) -describe("api functions", function() +describe("api metadata", function() before_each(clear) local function name_table(entries) @@ -87,26 +88,23 @@ describe("api functions", function() end end - it("are compatible with old metadata or have new level", function() - local api = helpers.call('api_info') - local compat = api.version.api_compatible - local api_level = api.version.api_level - local stable + local api, compat, stable, api_level + local old_api = {} + setup(function() + api = meths.get_api_info()[2] + compat = api.version.api_compatible + api_level = api.version.api_level if api.version.api_prerelease then stable = api_level-1 else stable = api_level end - local funcs_new = name_table(api.functions) - local ui_events_new = name_table(api.ui_events) - local funcs_compat = {} - local ui_events_compat = {} for level = compat, stable do local path = ('test/functional/fixtures/api_level_'.. tostring(level)..'.mpack') - local old_api = read_mpack_file(path) - if old_api == nil then + old_api[level] = read_mpack_file(path) + if old_api[level] == nil then local errstr = "missing metadata fixture for stable level "..level..". " if level == api_level and not api.version.api_prerelease then errstr = (errstr.."If NVIM_API_CURRENT was bumped, ".. @@ -116,10 +114,16 @@ describe("api functions", function() end if level == 0 then - clean_level_0(old_api) + clean_level_0(old_api[level]) end + end + end) - for _,f in ipairs(old_api.functions) do + it("functions are compatible with old metadata or have new level", function() + local funcs_new = name_table(api.functions) + local funcs_compat = {} + for level = compat, stable do + for _,f in ipairs(old_api[level].functions) do if funcs_new[f.name] == nil then if f.since >= compat then error('function '..f.name..' was removed but exists in level '.. @@ -130,18 +134,7 @@ describe("api functions", function() filter_function_metadata(funcs_new[f.name])) end end - funcs_compat[level] = name_table(old_api.functions) - - -- UI events were formalized in level 3 - if level >= 3 then - for _,e in ipairs(old_api.ui_events) do - local new_e = ui_events_new[e.name] - if new_e ~= nil then - check_ui_event_compatible(e, new_e) - end - end - ui_events_compat[level] = name_table(old_api.ui_events) - end + funcs_compat[level] = name_table(old_api[level].functions) end for _,f in ipairs(api.functions) do @@ -171,6 +164,22 @@ describe("api functions", function() end end end + end) + + it("UI events are compatible with old metadata or have new level", function() + local ui_events_new = name_table(api.ui_events) + local ui_events_compat = {} + + -- UI events were formalized in level 3 + for level = 3, stable do + for _,e in ipairs(old_api[level].ui_events) do + local new_e = ui_events_new[e.name] + if new_e ~= nil then + check_ui_event_compatible(e, new_e) + end + end + ui_events_compat[level] = name_table(old_api[level].ui_events) + end for _,e in ipairs(api.ui_events) do if e.since <= stable then @@ -197,15 +206,18 @@ describe("api functions", function() end end) -end) - -describe("ui_options in metadata", function() - it('are correct', function() - -- TODO(bfredl) once a release freezes this into metadata, - -- instead check that all old options are present - local api = helpers.call('api_info') - local options = api.ui_options - eq({'rgb', 'ext_cmdline', 'ext_popupmenu', - 'ext_tabline', 'ext_wildmenu', 'ext_linegrid', 'ext_hlstate'}, options) + it("ui_options are preserved from older levels", function() + local available_options = {} + for _, option in ipairs(api.ui_options) do + available_options[option] = true + end + -- UI options were versioned from level 4 + for level = 4, stable do + for _, option in ipairs(old_api[level].ui_options) do + if not available_options[option] then + error("UI option "..option.." from stable metadata is missing") + end + end + end end) end) diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index 6abeb0b2f4..bc0e2e3799 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -20,6 +20,9 @@ describe('Signs', function() [6] = {foreground = Screen.colors.Brown}, [7] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}, [8] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, + [9] = {bold = true, foreground = Screen.colors.Magenta}, + [10] = {foreground = Screen.colors.Blue1}, + [11] = {bold = true, foreground = Screen.colors.SeaGreen4}, } ) end) @@ -111,5 +114,45 @@ describe('Signs', function() | ]]) end) + + it('can have 32bit sign IDs', function() + command('sign define piet text=>> texthl=Search') + command('sign place 100000 line=1 name=piet buffer=1') + feed(':sign place<cr>') + screen:expect([[ + {1:>>} | + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {4: }| + :sign place | + {9:--- Signs ---} | + {10:Signs for [NULL]:} | + line=1 id=100000 name=piet | + | + {11:Press ENTER or type command to continue}^ | + ]]) + + feed('<cr>') + screen:expect([[ + {1:>>}^ | + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + {2: }{0:~ }| + | + ]]) + end) end) end) diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index cad6ee785e..da3338f92c 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -158,8 +158,8 @@ set(GPERF_SHA256 588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae set(WINTOOLS_URL https://github.com/neovim/deps/raw/2f9acbecf06365c10baa3c0087f34a54c9c6f949/opt/win32tools.zip) set(WINTOOLS_SHA256 8bfce7e3a365721a027ce842f2ec1cf878f1726233c215c05964aac07300798c) -set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.10/neovim-qt.zip) -set(WINGUI_SHA256 97988a96994b6066ea2b5f035a633304d664b8a14c91e946c5833a6e3782fdbb) +set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.11/neovim-qt.zip) +set(WINGUI_SHA256 b7add4b14561a2d8f55d3bbffb1d887209e4f26f837836639c2efeaaed9fa04e) set(WIN32YANK_X86_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x86.zip) set(WIN32YANK_X86_SHA256 62f34e5a46c5d4a7b3f3b512e1ff7b77fedd432f42581cbe825233a996eed62c) |