aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/InstallClintErrors.cmake2
-rw-r--r--src/nvim/CMakeLists.txt28
-rw-r--r--src/nvim/file_search.h5
-rw-r--r--src/nvim/hardcopy.h4
-rw-r--r--src/nvim/if_cscope.h3
-rw-r--r--src/nvim/mark.h1
-rw-r--r--src/nvim/mbyte.h1
-rw-r--r--src/nvim/memline.h2
-rw-r--r--src/nvim/menu.h5
-rw-r--r--src/nvim/ops.h2
-rw-r--r--test/functional/helpers.lua7
-rw-r--r--test/functional/terminal/tui_spec.lua106
12 files changed, 102 insertions, 64 deletions
diff --git a/cmake/InstallClintErrors.cmake b/cmake/InstallClintErrors.cmake
new file mode 100644
index 0000000000..bd5ca07828
--- /dev/null
+++ b/cmake/InstallClintErrors.cmake
@@ -0,0 +1,2 @@
+file(GLOB_RECURSE JSON_FILES *.json)
+file(COPY ${JSON_FILES} DESTINATION "${TARGET}")
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 24a6ec8b5e..1daa5dc3c4 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -41,7 +41,7 @@ set(LINT_SUPPRESS_URL "${LINT_SUPPRESS_URL_BASE}/errors.json")
set(LINT_PRG ${PROJECT_SOURCE_DIR}/src/clint.py)
set(DOWNLOAD_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Download.cmake)
set(LINT_SUPPRESSES_ROOT ${PROJECT_BINARY_DIR}/errors)
-set(LINT_SUPPRESSES_URL "https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.tar.gz")
+set(LINT_SUPPRESSES_URL "${LINT_SUPPRESS_URL_BASE}/errors.tar.gz")
include_directories(${GENERATED_DIR})
include_directories(${CACHED_GENERATED_DIR})
@@ -424,19 +424,10 @@ function(get_test_target prefix sfile relative_path_var target_var)
endfunction()
set(NO_SINGLE_CHECK_HEADERS
- file_search.h
getchar.h
- hardcopy.h
- if_cscope.h
if_cscope_defs.h
- mark.h
- mbyte.h
- memfile_defs.h
- memline.h
- menu.h
misc2.h
msgpack_rpc/server.h
- ops.h
option.h
os/shell.h
os_unix.h
@@ -495,6 +486,20 @@ function(add_download output url allow_failure)
)
endfunction()
+include(ExternalProject)
+ExternalProject_Add(
+ clint-error-files
+ PREFIX "${LINT_SUPPRESSES_ROOT}"
+ URL "${LINT_SUPPRESSES_URL}"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ BUILD_IN_SOURCE 1
+ INSTALL_COMMAND
+ "${CMAKE_COMMAND}"
+ -DTARGET=${LINT_SUPPRESSES_ROOT}
+ -P "${PROJECT_SOURCE_DIR}/cmake/InstallClintErrors.cmake"
+)
+
add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL} off)
set(LINT_NVIM_REL_SOURCES)
@@ -503,14 +508,13 @@ foreach(sfile ${LINT_NVIM_SOURCES})
set(suppress_file ${LINT_SUPPRESSES_ROOT}/${suffix}.json)
set(suppress_url "${LINT_SUPPRESS_URL_BASE}/${suffix}.json")
set(rsfile src/nvim/${r})
- add_download(${suppress_file} ${suppress_url} on)
set(touch_file "${TOUCHES_DIR}/ran-clint-${suffix}")
add_custom_command(
OUTPUT ${touch_file}
COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} ${rsfile}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E touch ${touch_file}
- DEPENDS ${LINT_PRG} ${sfile} ${suppress_file}
+ DEPENDS ${LINT_PRG} ${sfile} clint-error-files
)
list(APPEND LINT_TARGETS ${touch_file})
list(APPEND LINT_NVIM_REL_SOURCES ${rsfile})
diff --git a/src/nvim/file_search.h b/src/nvim/file_search.h
index 833a1a05ff..b128029123 100644
--- a/src/nvim/file_search.h
+++ b/src/nvim/file_search.h
@@ -1,6 +1,11 @@
#ifndef NVIM_FILE_SEARCH_H
#define NVIM_FILE_SEARCH_H
+#include <stdlib.h> // for size_t
+
+#include "nvim/types.h" // for char_u
+#include "nvim/globals.h" // for CdScope
+
/* Flags for find_file_*() functions. */
#define FINDFILE_FILE 0 /* only files */
#define FINDFILE_DIR 1 /* only directories */
diff --git a/src/nvim/hardcopy.h b/src/nvim/hardcopy.h
index 4ead8dd5d4..a70b20e6f5 100644
--- a/src/nvim/hardcopy.h
+++ b/src/nvim/hardcopy.h
@@ -2,6 +2,10 @@
#define NVIM_HARDCOPY_H
#include <stdint.h>
+#include <stdlib.h> // for size_t
+
+#include "nvim/types.h" // for char_u
+#include "nvim/ex_cmds_defs.h" // for exarg_T
/*
* Structure to hold printing color and font attributes.
diff --git a/src/nvim/if_cscope.h b/src/nvim/if_cscope.h
index 351d9caef6..e20462576a 100644
--- a/src/nvim/if_cscope.h
+++ b/src/nvim/if_cscope.h
@@ -1,6 +1,9 @@
#ifndef NVIM_IF_CSCOPE_H
#define NVIM_IF_CSCOPE_H
+#include "nvim/types.h" // for char_u and expand_T
+#include "nvim/ex_cmds_defs.h" // for exarg_T
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "if_cscope.h.generated.h"
#endif
diff --git a/src/nvim/mark.h b/src/nvim/mark.h
index efba9708db..c22a102926 100644
--- a/src/nvim/mark.h
+++ b/src/nvim/mark.h
@@ -8,6 +8,7 @@
#include "nvim/memory.h"
#include "nvim/pos.h"
#include "nvim/os/time.h"
+#include "nvim/ex_cmds_defs.h" // for exarg_T
/// Set fmark using given value
#define SET_FMARK(fmarkp_, mark_, fnum_) \
diff --git a/src/nvim/mbyte.h b/src/nvim/mbyte.h
index 3565202466..ad9e38004c 100644
--- a/src/nvim/mbyte.h
+++ b/src/nvim/mbyte.h
@@ -7,6 +7,7 @@
#include "nvim/iconv.h"
#include "nvim/func_attr.h"
#include "nvim/os/os_defs.h" // For WCHAR, indirect
+#include "nvim/types.h" // for char_u
/*
* Return byte length of character that starts with byte "b".
diff --git a/src/nvim/memline.h b/src/nvim/memline.h
index f84e86fea0..a239c6a031 100644
--- a/src/nvim/memline.h
+++ b/src/nvim/memline.h
@@ -2,6 +2,8 @@
#define NVIM_MEMLINE_H
#include "nvim/types.h"
+#include "nvim/pos.h" // for pos_T, linenr_T, colnr_T
+#include "nvim/buffer_defs.h" // for buf_T
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "memline.h.generated.h"
diff --git a/src/nvim/menu.h b/src/nvim/menu.h
index 3266c511b4..a84b7d812e 100644
--- a/src/nvim/menu.h
+++ b/src/nvim/menu.h
@@ -1,6 +1,11 @@
#ifndef NVIM_MENU_H
#define NVIM_MENU_H
+#include <stdbool.h> // for bool
+
+#include "nvim/types.h" // for char_u and expand_T
+#include "nvim/ex_cmds_defs.h" // for exarg_T
+
/* Indices into vimmenu_T->strings[] and vimmenu_T->noremap[] for each mode */
#define MENU_INDEX_INVALID -1
#define MENU_INDEX_NORMAL 0
diff --git a/src/nvim/ops.h b/src/nvim/ops.h
index 13d0142343..a8867e02ea 100644
--- a/src/nvim/ops.h
+++ b/src/nvim/ops.h
@@ -8,6 +8,8 @@
#include "nvim/types.h"
#include "nvim/eval/typval.h"
#include "nvim/os/time.h"
+#include "nvim/normal.h" // for MotionType and oparg_T
+#include "nvim/ex_cmds_defs.h" // for exarg_T
typedef int (*Indenter)(void);
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 335cf3c3ff..42ed1800d3 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -246,12 +246,13 @@ local function retry(max, max_ms, fn)
return result
end
if (max and tries >= max) or (luv.now() - start_time > timeout) then
- break
+ if type(result) == "string" then
+ result = "\nretry() attempts: "..tostring(tries).."\n"..result
+ end
+ error(result)
end
tries = tries + 1
end
- -- Do not use pcall() for the final attempt, let the failure bubble up.
- return fn()
end
local function clear(...)
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 90051b8cd5..e56fd2db5c 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -2,9 +2,10 @@
-- as a simple way to send keys and assert screen state.
local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
-local feed = thelpers.feed_data
+local feed_data = thelpers.feed_data
local execute = helpers.execute
local nvim_dir = helpers.nvim_dir
+local retry = helpers.retry
if helpers.pending_win32(pending) then return end
@@ -34,7 +35,7 @@ describe('tui', function()
end)
it('accepts basic utf-8 input', function()
- feed('iabc\ntest1\ntest2')
+ feed_data('iabc\ntest1\ntest2')
screen:expect([[
abc |
test1 |
@@ -44,7 +45,7 @@ describe('tui', function()
{3:-- INSERT --} |
{3:-- TERMINAL --} |
]])
- feed('\027')
+ feed_data('\027')
screen:expect([[
abc |
test1 |
@@ -60,7 +61,7 @@ describe('tui', function()
local keys = 'dfghjkl'
for c in keys:gmatch('.') do
execute('nnoremap <a-'..c..'> ialt-'..c..'<cr><esc>')
- feed('\027'..c)
+ feed_data('\027'..c)
end
screen:expect([[
alt-j |
@@ -71,7 +72,7 @@ describe('tui', function()
|
{3:-- TERMINAL --} |
]])
- feed('gg')
+ feed_data('gg')
screen:expect([[
{1:a}lt-d |
alt-f |
@@ -90,7 +91,7 @@ describe('tui', function()
-- Example: for input ALT+j:
-- * Vim (Nvim prior to #3982) sets high-bit, inserts "ê".
-- * Nvim (after #3982) inserts "j".
- feed('i\027j')
+ feed_data('i\027j')
screen:expect([[
j{1: } |
{4:~ }|
@@ -103,10 +104,10 @@ describe('tui', function()
end)
it('accepts ascii control sequences', function()
- feed('i')
- feed('\022\007') -- ctrl+g
- feed('\022\022') -- ctrl+v
- feed('\022\013') -- ctrl+m
+ feed_data('i')
+ feed_data('\022\007') -- ctrl+g
+ feed_data('\022\022') -- ctrl+v
+ feed_data('\022\013') -- ctrl+m
screen:expect([[
{9:^G^V^M}{1: } |
{4:~ }|
@@ -119,7 +120,7 @@ describe('tui', function()
end)
it('automatically sends <Paste> for bracketed paste sequences', function()
- feed('i\027[200~')
+ feed_data('i\027[200~')
screen:expect([[
{1: } |
{4:~ }|
@@ -129,7 +130,7 @@ describe('tui', function()
{3:-- INSERT (paste) --} |
{3:-- TERMINAL --} |
]])
- feed('pasted from terminal')
+ feed_data('pasted from terminal')
screen:expect([[
pasted from terminal{1: } |
{4:~ }|
@@ -139,7 +140,7 @@ describe('tui', function()
{3:-- INSERT (paste) --} |
{3:-- TERMINAL --} |
]])
- feed('\027[201~')
+ feed_data('\027[201~')
screen:expect([[
pasted from terminal{1: } |
{4:~ }|
@@ -157,7 +158,7 @@ describe('tui', function()
for i = 1, 3000 do
t[i] = 'item ' .. tostring(i)
end
- feed('i\027[200~'..table.concat(t, '\n')..'\027[201~')
+ feed_data('i\027[200~'..table.concat(t, '\n')..'\027[201~')
screen:expect([[
item 2997 |
item 2998 |
@@ -180,7 +181,7 @@ describe('tui with non-tty file descriptors', function()
it('can handle pipes as stdout and stderr', function()
local screen = thelpers.screen_setup(0, '"'..helpers.nvim_prog
..' -u NONE -i NONE --cmd \'set noswapfile noshowcmd noruler\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"')
- feed(':w testF\n:q\n')
+ feed_data(':w testF\n:q\n')
screen:expect([[
:w testF |
:q |
@@ -200,12 +201,13 @@ describe('tui focus event handling', function()
helpers.clear()
screen = thelpers.screen_setup(0, '["'..helpers.nvim_prog
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler"]')
- execute('autocmd FocusGained * echo "gained"')
- execute('autocmd FocusLost * echo "lost"')
+ feed_data(":autocmd FocusGained * echo 'gained'\n")
+ feed_data(":autocmd FocusLost * echo 'lost'\n")
+ feed_data("\034\016") -- CTRL-\ CTRL-N
end)
it('can handle focus events in normal mode', function()
- feed('\027[I')
+ feed_data('\027[I')
screen:expect([[
{1: } |
{4:~ }|
@@ -216,7 +218,7 @@ describe('tui focus event handling', function()
{3:-- TERMINAL --} |
]])
- feed('\027[O')
+ feed_data('\027[O')
screen:expect([[
{1: } |
{4:~ }|
@@ -230,8 +232,8 @@ describe('tui focus event handling', function()
it('can handle focus events in insert mode', function()
execute('set noshowmode')
- feed('i')
- feed('\027[I')
+ feed_data('i')
+ feed_data('\027[I')
screen:expect([[
{1: } |
{4:~ }|
@@ -241,7 +243,7 @@ describe('tui focus event handling', function()
gained |
{3:-- TERMINAL --} |
]])
- feed('\027[O')
+ feed_data('\027[O')
screen:expect([[
{1: } |
{4:~ }|
@@ -254,8 +256,8 @@ describe('tui focus event handling', function()
end)
it('can handle focus events in cmdline mode', function()
- feed(':')
- feed('\027[I')
+ feed_data(':')
+ feed_data('\027[I')
screen:expect([[
|
{4:~ }|
@@ -265,7 +267,7 @@ describe('tui focus event handling', function()
g{1:a}ined |
{3:-- TERMINAL --} |
]])
- feed('\027[O')
+ feed_data('\027[O')
screen:expect([[
|
{4:~ }|
@@ -278,30 +280,36 @@ describe('tui focus event handling', function()
end)
it('can handle focus events in terminal mode', function()
- execute('set shell='..nvim_dir..'/shell-test')
- execute('set laststatus=0')
- execute('set noshowmode')
- execute('terminal')
- feed('\027[I')
- screen:expect([[
- ready $ |
- [Process exited 0]{1: } |
- |
- |
- |
- gained |
- {3:-- TERMINAL --} |
- ]])
- feed('\027[O')
- screen:expect([[
- ready $ |
- [Process exited 0]{1: } |
- |
- |
- |
- lost |
- {3:-- TERMINAL --} |
- ]])
+ feed_data(':set shell='..nvim_dir..'/shell-test\n')
+ feed_data(':set noshowmode laststatus=0\n')
+
+ retry(2, 3 * screen.timeout, function()
+ feed_data(':terminal\n')
+ feed_data('\027[I')
+ screen:expect([[
+ ready $ |
+ [Process exited 0]{1: } |
+ |
+ |
+ |
+ gained |
+ {3:-- TERMINAL --} |
+ ]])
+ feed_data('\027[O')
+ screen:expect([[
+ ready $ |
+ [Process exited 0]{1: } |
+ |
+ |
+ |
+ lost |
+ {3:-- TERMINAL --} |
+ ]])
+
+ -- If retry is needed...
+ feed_data("\034\016") -- CTRL-\ CTRL-N
+ feed_data(':bwipeout!\n')
+ end)
end)
end)